diff options
author | Max Horn | 2010-10-30 21:27:42 +0000 |
---|---|---|
committer | Max Horn | 2010-10-30 21:27:42 +0000 |
commit | 44393b2dc8ba78342dcbb7df39eca2e9e1f6e429 (patch) | |
tree | b5b2d7013d64ca317072453a7fbbc391174e2851 /backends/platform/sdl | |
parent | ff34a778318355ffba2ee5700524fccba9fe5cf3 (diff) | |
download | scummvm-rg350-44393b2dc8ba78342dcbb7df39eca2e9e1f6e429.tar.gz scummvm-rg350-44393b2dc8ba78342dcbb7df39eca2e9e1f6e429.tar.bz2 scummvm-rg350-44393b2dc8ba78342dcbb7df39eca2e9e1f6e429.zip |
ALL: Add code to help stop people from accidentally using "bad" APIs
A new header file common/forbidden.h is included by scummsys.h and it
re-#defines numerous symbols like fopen(), fread(), system(), etc. with
garbage, in order to provoke compile errors in any code using them.
If a .cpp file really *must* use any of these (e.g. because it is a
backend file), then these redefinitions can be disabled by #defining
FORBIDDEN_SYMBOL_ALLOW_ALL as the first thing in the .cpp file. Whenever
this is done, an explanatory comment should be added.
Note that this system cannot catch all "bad" usages (notably the Lua
code in the sword25 engine), as it can only work if scummsys.h is
included.
svn-id: r53961
Diffstat (limited to 'backends/platform/sdl')
-rw-r--r-- | backends/platform/sdl/main.cpp | 2 | ||||
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/backends/platform/sdl/main.cpp b/backends/platform/sdl/main.cpp index 60bf59689c..a9e1f5cf4b 100644 --- a/backends/platform/sdl/main.cpp +++ b/backends/platform/sdl/main.cpp @@ -23,6 +23,8 @@ * */ +#define FORBIDDEN_SYMBOL_ALLOW_ALL + // Fix for bug #2895217 "MSVC compilation broken with r47595": // We need to keep this on top of the "common/scummsys.h" include, // otherwise we will get errors about the windows headers redefining diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 83393c225a..8725a7df8a 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -23,6 +23,9 @@ * */ +// Disable symbol overrides so that we can use system headers. +#define FORBIDDEN_SYMBOL_ALLOW_ALL + #if defined(WIN32) #define WIN32_LEAN_AND_MEAN #include <windows.h> @@ -79,7 +82,7 @@ #endif #if defined(MACOSX) || defined(IPHONE) -#include "CoreFoundation/CoreFoundation.h" +#include <CoreFoundation/CoreFoundation.h> #endif |