Mercurial > hg > openttd
changeset 6083:37a5650e8596 draft
(svn r8818) -Codechange: remove the #ifdef _cplusplus remnants.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Mon, 19 Feb 2007 21:11:44 +0000 |
parents | 5f47e1a0bd33 |
children | 6e2526ba7cb5 |
files | src/helpers.hpp src/macros.h src/stdafx.h |
diffstat | 3 files changed, 5 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/src/helpers.hpp +++ b/src/helpers.hpp @@ -6,8 +6,6 @@ /** @file helpers.hpp */ #include "macros.h" -#ifdef __cplusplus - /** When allocating using malloc/calloc in C++ it is usually needed to cast the return value * from void* to the proper pointer type. Another alternative would be MallocT<> as follows */ template <typename T> FORCEINLINE T* MallocT(size_t num_elements) @@ -161,12 +159,4 @@ return (T)val; } -#else // __cplusplus - -#define DECLARE_POSTFIX_INCREMENT(E) -#define DECLARE_ENUM_AS_BIT_SET(E) -#define DECLARE_ENUM_AS_BIT_INDEX(E1,E2) - -#endif // __cplusplus - #endif /* HELPERS_HPP */
--- a/src/macros.h +++ b/src/macros.h @@ -18,14 +18,11 @@ #undef max #endif -/* Objective C don't like templates */ -#ifdef __cplusplus template <typename T> static inline T max(T a, T b) { return a >= b ? a : b; } -#endif static inline int min(int a, int b) { if (a <= b) return a; return b; }
--- a/src/stdafx.h +++ b/src/stdafx.h @@ -234,23 +234,12 @@ #endif #ifndef __BEOS__ - -/* some platforms use 4 bytes bool in C++ - * C bool has to be the same */ -# ifndef __cplusplus -# ifdef FOUR_BYTE_BOOL - typedef unsigned long bool; -# else /* FOUR_BYTE_BOOL */ - typedef unsigned char bool; -# endif /* FOUR_BYTE_BOOL */ -# endif /* __cplusplus */ - typedef signed char int8; typedef signed short int16; typedef signed int int32; typedef signed __int64 int64; typedef unsigned __int64 uint64; -#endif /* __BEOS__ */ +#endif /* !__BEOS__ */ #if defined(ARM) || defined(__arm__) || defined(__alpha__) # define OTTD_ALIGNMENT @@ -289,24 +278,11 @@ # define PERSONAL_DIR "" #endif -#ifndef __cplusplus -# ifndef __BEOS__ - enum { - false = 0, - true = 1, - }; -# endif -#endif /* __cplusplus */ - /* Compile time assertions */ #ifdef __OS2__ # define assert_compile(expr) #else -# ifdef __cplusplus -# define assert_compile(expr) extern "C" void __ct_assert__(int a[1 - 2 * !(expr)]) -# else /* __cplusplus */ -# define assert_compile(expr) void __ct_assert__(int a[1 - 2 * !(expr)]) -# endif /* !__cplusplus */ +# define assert_compile(expr) extern "C" void __ct_assert__(int a[1 - 2 * !(expr)]) #endif /* __OS2__ */ assert_compile(sizeof(uint32) == 4); @@ -317,16 +293,10 @@ #define endof(x) (&x[lengthof(x)]) #define lastof(x) (&x[lengthof(x) - 1]) -#ifdef offsetof -# undef offsetof -#endif - -#ifndef __cplusplus -# define offsetof(s,m) (size_t)&(((s *)0)->m) -#else /* __cplusplus */ -# define cpp_offsetof(s,m) (((size_t)&reinterpret_cast<const volatile char&>((((s*)(char*)8)->m))) - 8) +#define cpp_offsetof(s,m) (((size_t)&reinterpret_cast<const volatile char&>((((s*)(char*)8)->m))) - 8) +#ifndef offsetof # define offsetof(s,m) cpp_offsetof(s, m) -#endif /* __cplusplus */ +#endif /* offsetof */ /* take care of some name clashes on MacOS */