[llvm] r174073 - Turn off missing field initializer warnings for gcc
Edwin Vane
edwin.vane at intel.com
Thu Jan 31 10:05:54 PST 2013
Author: revane
Date: Thu Jan 31 12:05:54 2013
New Revision: 174073
URL: http://llvm.org/viewvc/llvm-project?rev=174073&view=rev
Log:
Turn off missing field initializer warnings for gcc
gcc produces false positives for empty braces so turning the warning off.
Instead, turning the warning on for clang so proper warnings aren't missed.
Reviewers: dblaikie, chandlerc
Modified:
llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=174073&r1=174072&r2=174073&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Thu Jan 31 12:05:54 2013
@@ -178,6 +178,19 @@ if( MSVC )
elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
if (LLVM_ENABLE_WARNINGS)
add_llvm_definitions( -Wall -W -Wno-unused-parameter -Wwrite-strings )
+
+ # Turn off missing field initializer warnings for gcc to avoid noise from
+ # false positives with empty {}. Turn them on otherwise (they're off by
+ # default for clang).
+ check_cxx_compiler_flag("-Wmissing-field-initializers" CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG)
+ if (CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG)
+ if (CMAKE_COMPILER_IS_GNUCXX)
+ add_llvm_definitions( -Wno-missing-field-initializers )
+ else()
+ add_llvm_definitions( -Wmissing-field-initializers )
+ endif()
+ endif()
+
if (LLVM_ENABLE_PEDANTIC)
add_llvm_definitions( -pedantic -Wno-long-long )
endif (LLVM_ENABLE_PEDANTIC)
More information about the llvm-commits
mailing list