Fixed bug 2121 - GCC throws error on SDL_FORCE_INLINE when compiling with -ansi
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
diff --git a/include/begin_code.h b/include/begin_code.h
index 902aeb1..5261d26 100644
--- a/include/begin_code.h
+++ b/include/begin_code.h
@@ -99,11 +99,9 @@
#endif
#endif /* Compiler needs structure packing set */
+#ifndef __inline__
/* Set up compiler-specific options for inlining functions */
#ifndef SDL_INLINE_OKAY
-#ifdef __GNUC__
-#define SDL_INLINE_OKAY
-#else
/* Add any special compiler-specific cases here */
#if defined(_MSC_VER) || defined(__BORLANDC__) || \
defined(__DMC__) || defined(__SC__) || \
@@ -112,31 +110,34 @@
#ifndef __inline__
#define __inline__ __inline
#endif
-#define SDL_INLINE_OKAY
+#define SDL_INLINE_OKAY 1
#else
#if !defined(__MRC__) && !defined(_SGI_SOURCE)
#ifndef __inline__
#define __inline__ inline
#endif
-#define SDL_INLINE_OKAY
+#define SDL_INLINE_OKAY 1
#endif /* Not a funky compiler */
#endif /* Visual C++ */
-#endif /* GNU C */
#endif /* SDL_INLINE_OKAY */
/* If inlining isn't supported, remove "__inline__", turning static
inlined functions into static functions (resulting in code bloat
in all files which include the offending header files)
*/
-#ifndef SDL_INLINE_OKAY
+#if !SDL_INLINE_OKAY || __STRICT_ANSI__
+#ifdef __inline__
+#undef __inline__
+#endif
#define __inline__
#endif
+#endif /* __inline__ not defined */
#ifndef SDL_FORCE_INLINE
#if defined(_MSC_VER)
#define SDL_FORCE_INLINE __forceinline
#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
-#define SDL_FORCE_INLINE __attribute__((always_inline)) static inline
+#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
#else
#define SDL_FORCE_INLINE static __inline__
#endif
diff --git a/src/filesystem/cocoa/SDL_sysfilesystem.m b/src/filesystem/cocoa/SDL_sysfilesystem.m
index c9b0ecc..43e024c 100644
--- a/src/filesystem/cocoa/SDL_sysfilesystem.m
+++ b/src/filesystem/cocoa/SDL_sysfilesystem.m
@@ -73,9 +73,9 @@ SDL_GetPrefPath(const char *org, const char *app)
NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
char *retval = NULL;
- (void) org; // unused on Mac OS X and iOS.
+ (void) org; /* unused on Mac OS X and iOS. */
- if ([array count] > 0) { // we only want the first item in the list.
+ if ([array count] > 0) { /* we only want the first item in the list. */
NSString *str = [array objectAtIndex:0];
const char *base = [str UTF8String];
if (base) {
diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m
index d71cb17..501684f 100644
--- a/src/video/cocoa/SDL_cocoamodes.m
+++ b/src/video/cocoa/SDL_cocoamodes.m
@@ -33,7 +33,9 @@
/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
#include <AvailabilityMacros.h>
-static inline void Cocoa_ToggleMenuBar(const BOOL show)
+
+static void
+Cocoa_ToggleMenuBar(const BOOL show)
{
/* !!! FIXME: keep an eye on this.
* ShowMenuBar/HideMenuBar is officially unavailable for 64-bit binaries.
@@ -57,7 +59,7 @@ static inline void Cocoa_ToggleMenuBar(const BOOL show)
#define MAC_OS_X_VERSION_MIN_REQUIRED 1050
#endif
-static inline BOOL
+static BOOL
IS_SNOW_LEOPARD_OR_LATER(_THIS)
{
#if FORCE_OLD_API
@@ -179,7 +181,7 @@ GetDisplayMode(_THIS, const void *moderef, SDL_DisplayMode *mode)
return SDL_TRUE;
}
-static inline void
+static void
Cocoa_ReleaseDisplayMode(_THIS, const void *moderef)
{
if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
@@ -187,7 +189,7 @@ Cocoa_ReleaseDisplayMode(_THIS, const void *moderef)
}
}
-static inline void
+static void
Cocoa_ReleaseDisplayModeList(_THIS, CFArrayRef modelist)
{
if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
diff --git a/src/video/cocoa/SDL_cocoashape.m b/src/video/cocoa/SDL_cocoashape.m
index 7108526..ae8df8d 100644
--- a/src/video/cocoa/SDL_cocoashape.m
+++ b/src/video/cocoa/SDL_cocoashape.m
@@ -82,8 +82,8 @@ Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShape
data->saved = SDL_FALSE;
}
- //[data->context saveGraphicsState];
- //data->saved = SDL_TRUE;
+ /*[data->context saveGraphicsState];*/
+ /*data->saved = SDL_TRUE;*/
[NSGraphicsContext setCurrentContext:data->context];
[[NSColor clearColor] set];
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index 581590b..923cd51 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -44,7 +44,7 @@
static Uint32 s_moveHack;
-static __inline__ void ConvertNSRect(NSRect *r)
+static void ConvertNSRect(NSRect *r)
{
r->origin.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - r->origin.y - r->size.height;
}
@@ -920,8 +920,9 @@ Cocoa_RaiseWindow(_THIS, SDL_Window * window)
SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata);
NSWindow *nswindow = windowData->nswindow;
- // makeKeyAndOrderFront: has the side-effect of deminiaturizing and showing
- // a minimized or hidden window, so check for that before showing it.
+ /* makeKeyAndOrderFront: has the side-effect of deminiaturizing and showing
+ a minimized or hidden window, so check for that before showing it.
+ */
[windowData->listener pauseVisibleObservation];
if (![nswindow isMiniaturized] && [nswindow isVisible]) {
[nswindow makeKeyAndOrderFront:nil];