Commit dfa643c3 authored by Sam Lantinga's avatar Sam Lantinga

Fixed bug #176

[I'm fixing this for the public headers, but I'm not going to bother for the SDL library code (yet)]

To clarify: Normaly, GCC (or, to be precise, the preprocessor) will ignore
this, and compile the code happily. However, one can specify -Wundef to get a
warning about this.

One can probably argue whether to consider this a bug or not; but I think that
(a) from a semantic point of view, using "#if FOO" when FOO is not defined is
strange, and (b) since it is possible to trigger a warning about this, and a
trivial fix exists, it should be corrected.

I can think of two alternative patches, BTW:
1) Simply use #define HAVE_FOO 0, instead of not defining HAVE_FOO at all
2) Change
  #if HAVE_FOO
to
  #if HAVE_FOO+0
which always does the right thing.

But I think I still prefer the attached patch :-).

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401633
parent 678ac924
...@@ -63,7 +63,7 @@ typedef unsigned int uintptr_t; ...@@ -63,7 +63,7 @@ typedef unsigned int uintptr_t;
/* Enabled for SDL 1.2 (binary compatibility) */ /* Enabled for SDL 1.2 (binary compatibility) */
#define HAVE_LIBC 1 #define HAVE_LIBC 1
#if HAVE_LIBC #ifdef HAVE_LIBC
/* Useful headers */ /* Useful headers */
#define HAVE_STDIO_H 1 #define HAVE_STDIO_H 1
#define STDC_HEADERS 1 #define STDC_HEADERS 1
......
This diff is collapsed.
...@@ -46,7 +46,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo; ...@@ -46,7 +46,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo;
#else #else
/* This is the structure for custom window manager events */ /* This is the structure for custom window manager events */
#if SDL_VIDEO_DRIVER_X11 #if defined(SDL_VIDEO_DRIVER_X11)
#if defined(__APPLE__) && defined(__MACH__) #if defined(__APPLE__) && defined(__MACH__)
/* conflicts with Quickdraw.h */ /* conflicts with Quickdraw.h */
#define Cursor X11Cursor #define Cursor X11Cursor
...@@ -100,7 +100,7 @@ typedef struct SDL_SysWMinfo { ...@@ -100,7 +100,7 @@ typedef struct SDL_SysWMinfo {
} info; } info;
} SDL_SysWMinfo; } SDL_SysWMinfo;
#elif SDL_VIDEO_DRIVER_NANOX #elif defined(SDL_VIDEO_DRIVER_NANOX)
#include <microwin/nano-X.h> #include <microwin/nano-X.h>
/* The generic custom event structure */ /* The generic custom event structure */
...@@ -115,7 +115,7 @@ typedef struct SDL_SysWMinfo { ...@@ -115,7 +115,7 @@ typedef struct SDL_SysWMinfo {
GR_WINDOW_ID window ; /* The display window */ GR_WINDOW_ID window ; /* The display window */
} SDL_SysWMinfo; } SDL_SysWMinfo;
#elif SDL_VIDEO_DRIVER_WINDIB || SDL_VIDEO_DRIVER_DDRAW #elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW)
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
...@@ -135,7 +135,7 @@ typedef struct SDL_SysWMinfo { ...@@ -135,7 +135,7 @@ typedef struct SDL_SysWMinfo {
HGLRC hglrc; /* The OpenGL context, if any */ HGLRC hglrc; /* The OpenGL context, if any */
} SDL_SysWMinfo; } SDL_SysWMinfo;
#elif SDL_VIDEO_DRIVER_RISCOS #elif defined(SDL_VIDEO_DRIVER_RISCOS)
/* RISC OS custom event structure */ /* RISC OS custom event structure */
struct SDL_SysWMmsg { struct SDL_SysWMmsg {
...@@ -152,7 +152,7 @@ typedef struct SDL_SysWMinfo { ...@@ -152,7 +152,7 @@ typedef struct SDL_SysWMinfo {
int window; /* The RISC OS display window */ int window; /* The RISC OS display window */
} SDL_SysWMinfo; } SDL_SysWMinfo;
#elif SDL_VIDEO_DRIVER_PHOTON #elif defined(SDL_VIDEO_DRIVER_PHOTON)
#include <sys/neutrino.h> #include <sys/neutrino.h>
#include <Ph.h> #include <Ph.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment