Skip to content

Commit

Permalink
Turn off redundant move warnings
Browse files Browse the repository at this point in the history
Summary:
The redundant move warning added in GCC 9 can be misleading. Some
moves that it warns for may not be redundant on older compilers,
particularly when type conversions are involved.

Reviewed By: tmikov

Differential Revision: D23893822

fbshipit-source-id: 637211b22942e0c280202f0f3ea1c7f57989c56c
  • Loading branch information
neildhar authored and facebook-github-bot committed Sep 24, 2020
1 parent 7d3c17f commit a3d57bb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,17 @@ if (NOT (GENERATOR_IS_MULTI_CONFIG OR CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_C
option(HERMES_ENABLE_LTO "Build Hermes with LTO" ON)
endif()

if (GCC_COMPATIBLE)
if (CMAKE_COMPILER_IS_GNUCXX)
# Suppress uninteresting warnings about initializing ArrayRef from initializer lists.
check_cxx_compiler_flag("-Winit-list-lifetime" INIT_LIST_LIFETIME_FLAG)
append_if(INIT_LIST_LIFETIME_FLAG "-Wno-init-list-lifetime" CMAKE_CXX_FLAGS)
# Suppress the redundant move warnings in GCC 9, because it leads to suboptimal
# recommendations for older compilers that do not implement C++ Core Issue 1579.
check_cxx_compiler_flag("-Wredundant-move" REDUNDANT_MOVE_FLAG)
append_if(REDUNDANT_MOVE_FLAG "-Wno-redundant-move" CMAKE_CXX_FLAGS)
endif()

if (GCC_COMPATIBLE)
# Don't export symbols unless we explicitly say so
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
Expand Down

0 comments on commit a3d57bb

Please sign in to comment.