Fixed bug #66009 Failed compilation of PHP extension with C++ std library using VS...
authorAnatol Belski <ab@php.net>
Fri, 3 Jan 2014 23:47:10 +0000 (00:47 +0100)
committerAnatol Belski <ab@php.net>
Sat, 4 Jan 2014 00:41:27 +0000 (01:41 +0100)
Visual Studio 2012 includes sanity checks for C++11 features, see
http://msdn.microsoft.com/en-us/library/vstudio/bb531344(v=vs.110).aspx
To fix the 'inline' keyword redefinition for C++ in debug mode, the
new macros ZEND_WIN32_KEEP_INLINE is introduced, ZEND_WIN32_FORCE_INLINE is
automatically appended in release mode.

TSRM/tsrm_config.w32.h
Zend/zend_config.w32.h

index 14c6443a03d61c602b4fefa1efc01a210753a4cf..1443e7cca9617ce041370eb118efbb6e8604e54c 100644 (file)
@@ -2,6 +2,7 @@
 #define TSRM_CONFIG_W32_H
 
 #include <../main/config.w32.h>
+#include "Zend/zend_config.w32.h"
 
 #define HAVE_UTIME 1
 #define HAVE_ALLOCA 1
 #include <stdlib.h>
 #include <crtdbg.h>
 
-#undef inline
-#ifdef ZEND_WIN32_FORCE_INLINE
-# define inline __forceinline
-#else
-# define inline
-#endif
-
-
 #endif
index f779a506e662b9d2e5f0398041f82b30a274644a..6ea67602b49826137219d091fe6641b7a90e68a8 100644 (file)
@@ -62,10 +62,15 @@ typedef unsigned int uint;
 /* This will cause the compilation process to be MUCH longer, but will generate
  * a much quicker PHP binary
  */
-#undef inline
 #ifdef ZEND_WIN32_FORCE_INLINE
+/* _ALLOW_KEYWORD_MACROS is only relevant for C++ */
+# if (_MSC_VER >= 1700) && !defined(_ALLOW_KEYWORD_MACROS)
+#  define _ALLOW_KEYWORD_MACROS
+# endif
+# undef inline
 # define inline __forceinline
-#else
+#elif !defined(ZEND_WIN32_KEEP_INLINE)
+# undef inline
 # define inline
 #endif