|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-01-02 13:55 UTC] ab@php.net
-Assigned To:
+Assigned To: ab
[2014-01-04 00:42 UTC] ab@php.net
[2014-01-04 00:42 UTC] ab@php.net
-Status: Assigned
+Status: Closed
[2014-01-04 00:42 UTC] ab@php.net
[2014-01-04 00:42 UTC] ab@php.net
[2014-01-04 00:49 UTC] ab@php.net
[2014-01-04 01:28 UTC] ab@php.net
[2014-01-05 18:23 UTC] ab@php.net
[2014-01-05 18:23 UTC] ab@php.net
[2014-01-05 22:06 UTC] ab@php.net
[2014-01-05 22:06 UTC] ab@php.net
[2014-01-17 21:59 UTC] bwoebi@php.net
[2014-02-06 08:43 UTC] bwoebi@php.net
[2016-07-20 11:40 UTC] davey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 04:00:02 2025 UTC |
Description: ------------ Suppose you have an PHP extension that uses C++ standard library. one of source files looks like: #ifdef __cplusplus extern "C" { #endif #include "php.h" #ifdef __cplusplus } #endif #include <string> ... After trying to compile this extension using Visual Studio 2012 you got the following error: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xkeycheck.h(242): fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro. Documentation for Visual Studio says: http://msdn.microsoft.com/en-us/libraRy/bb531344%28v=vs.110%29.aspx C++11 17.6.4.3.1 [macro.names]/2 forbids macro-izing keywords when C++ Standard Library headers are included. The headers now emit compiler errors if they detect macro-ized keywords. (Defining _ALLOW_KEYWORD_MACROS allows such code to compile, but we strongly discourage that usage.) This problem appeared because of the following code in PHP: \TSRM\tsrm_config.w32.h \Zend\zend_config.w32.h #undef inline #ifdef ZEND_WIN32_FORCE_INLINE # define inline __forceinline #else # define inline #endif Redefinition of keywords is forbidden in C++11 standard. Possible workaround is to use keyword provided by Microsoft: #define _ALLOW_KEYWORD_MACROS But this is not enough because in this case macro inline will be defined as empty, bringing problems in other code compilation (those functions that were defined as inline are not inline anymore), for example: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\ostream(1020): error C2491: 'std::endl' : definition of dllimport function not allowed Possible workaround for now is to define both: #define _ALLOW_KEYWORD_MACROS #define ZEND_WIN32_FORCE_INLINE Could you please resolve this issue somehow, for example by changing your define as follows: #ifdef ZEND_WIN32_FORCE_INLINE # undef inline # define inline __forceinline #endif or wrap it using other #ifdef to be able to stop redefining of inline macro in PHP code. Test script: --------------- #ifdef __cplusplus extern "C" { #endif #include "php.h" #ifdef __cplusplus } #endif #include <string> ... Expected result: ---------------- There is no redefinition of standard keyword "inline" in PHP code. Actual result: -------------- C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xkeycheck.h(242): fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.