X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6c99908c512489b614fb7a4fb010b1d6c2a6857e..6dd16e4f26490f1f4f2be1204840cbf4ecf74a35:/include/wx/defs.h diff --git a/include/wx/defs.h b/include/wx/defs.h index d86fbe57bb..4d6f2106b5 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -174,35 +174,26 @@ typedef unsigned int bool; #endif // bool -#ifdef __cplusplus - // define boolean constants: don't use true/false here as not all compilers - // support them but also redefine TRUE which could have been defined as 1 - // by previous headers: this would be incorrect as our TRUE is supposed to - // be of type bool, just like true, not int - // - // however if the user code absolutely needs TRUE to be defined in its own - // way, it can predefine WX_TRUE_DEFINED to prevent the redefinition here - #ifdef TRUE - #ifndef WX_TRUE_DEFINED - #undef TRUE - #undef FALSE - #endif - #endif +// deal with TRUE/true stuff: we assume that if the compiler supports bool, it +// supports true/false as well and that, OTOH, if it does _not_ support bool, +// it doesn't support these keywords (this is less sure, in particular VC++ +// 4.x could be a problem here) +#ifndef HAVE_BOOL + #define true ((bool)1) + #define false ((bool)0) +#endif - #ifndef TRUE - #define TRUE ((bool)1) - #define FALSE ((bool)0) - #endif -#else // !__cplusplus - // the definitions above don't work for C sources - #ifndef TRUE - #define TRUE 1 - #endif +// for backwards compatibility, also define TRUE and FALSE +// +// note that these definitions should work both in C++ and C code, so don't +// use true/false below +#ifndef TRUE + #define TRUE 1 +#endif - #ifndef FALSE - #define FALSE 0 - #endif -#endif // C++/!C++ +#ifndef FALSE + #define FALSE 0 +#endif typedef short int WXTYPE; @@ -254,7 +245,7 @@ typedef int wxWindowID; // ---------------------------------------------------------------------------- // stdcall is used for all functions called by Windows under Windows -#if defined(__WINDOWS__) && !defined(__WXWINE__) +#if defined(__WINDOWS__) #if defined(__GNUWIN32__) #define wxSTDCALL __attribute__((stdcall)) #else @@ -392,7 +383,7 @@ class WXDLLEXPORT wxEvent; #endif // Macro to issue warning when using deprecated functions with gcc3 or MSVC7: -#if wxCHECK_GCC_VERSION(3, 0) +#if wxCHECK_GCC_VERSION(3, 1) #define wxDEPRECATED(x) x __attribute__ ((deprecated)) #elif defined(__VISUALC__) && (__VISUALC__ >= 1300) #define wxDEPRECATED(x) __declspec(deprecated) x @@ -1931,7 +1922,7 @@ typedef WXHWND WXWidget; typedef unsigned int WXWPARAM; typedef long WXLPARAM; -#if !defined(__WIN32__) || defined(__GNUWIN32__) || defined(__WXWINE__) || defined(__WXMICROWIN__) +#if !defined(__WIN32__) || defined(__GNUWIN32__) || defined(__WXMICROWIN__) typedef int (*WXFARPROC)(); #else typedef int (__stdcall *WXFARPROC)();