Skip to content

Commit de57a5c

Browse files
mszabo-wikiafacebook-github-bot
authored andcommitted
Unset -fno-operator-names for Folly/boost compat (#9586)
Summary: folly/hash/Checksum.cpp includes boost/crc.hpp, which contains alternative operator representations on Boost < 1.84.0. This causes compilation failures when superproject CXXFLAGS are forwarded to Folly, since we set -fno-operator-names: ``` In file included from /hhvm/third-party/folly/src/folly/hash/Checksum.cpp:22: /hhvm/_build/third-party/boost/bundled_boost-prefix/include/boost/crc.hpp:678:68: error: use of undeclared identifier 'not' 678 | new_dividend_bits = reflect_optionally( new_dividend_bits, not reflect, | ^ /hhvm/_build/third-party/boost/bundled_boost-prefix/include/boost/crc.hpp:670:24: warning: unused parameter 'reflect' [-Wunused-parameter] 670 | word_length, bool reflect ) ``` As a fix, unset this compiler flag, since we have no control over the operator representations that third-party headers might choose to use. Pull Request resolved: #9586 Reviewed By: Wilfred Differential Revision: D68581416 fbshipit-source-id: a956b36c4305a54dabb22d803b6fd2cf505caec9
1 parent b00f225 commit de57a5c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

CMake/HPHPCompiler.cmake

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQU
6363
list(APPEND GENERAL_CXX_OPTIONS
6464
"std=gnu++1z"
6565
"fno-omit-frame-pointer"
66-
"fno-operator-names"
6766
"Wall"
6867
"Werror=format-security"
6968
"Wno-unused-variable"
@@ -166,7 +165,7 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQU
166165
CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.9)
167166
list(APPEND GENERAL_OPTIONS "fno-delete-null-pointer-checks")
168167
else()
169-
message(FATAL_ERROR "${PROJECT_NAME} requires g++ 4.9 or greater.")
168+
message(FATAL_ERROR "${PROJECT_NAME} requires g++ 4.9 or greater.")
170169
endif()
171170

172171
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.4)
@@ -175,7 +174,7 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQU
175174

176175
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 11.3 OR
177176
CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 11.3)
178-
message(WARNING "HHVM is primarily tested on GCC 7.4-11.3. Using other versions may produce unexpected results, or may not even build at all.")
177+
message(WARNING "HHVM is primarily tested on GCC 7.4-11.3. Using other versions may produce unexpected results, or may not even build at all.")
179178
endif()
180179

181180
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.1 OR
@@ -293,11 +292,11 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQU
293292
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2 -march=core-avx2")
294293
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -mavx2 -march=core-avx2")
295294
endif()
296-
# using Intel C++
295+
# using Intel C++
297296
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
298297
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -no-ipo -fp-model precise -wd584 -wd1418 -wd1918 -wd383 -wd869 -wd981 -wd424 -wd1419 -wd444 -wd271 -wd2259 -wd1572 -wd1599 -wd82 -wd177 -wd593 -w")
299298
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -no-ipo -fp-model precise -wd584 -wd1418 -wd1918 -wd383 -wd869 -wd981 -wd424 -wd1419 -wd444 -wd271 -wd2259 -wd1572 -wd1599 -wd82 -wd177 -wd593 -fno-omit-frame-pointer -Wall -Woverloaded-virtual -Wno-deprecated -w1 -Wno-strict-aliasing -Wno-write-strings -Wno-invalid-offsetof -fno-operator-names")
300-
# using Visual Studio C++
299+
# using Visual Studio C++
301300
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
302301
message(WARNING "MSVC support is VERY experimental. It will likely not compile, and is intended for the utterly insane.")
303302

0 commit comments

Comments
 (0)