diff options
author | Edwin Vane <edwin.vane@intel.com> | 2013-01-31 18:05:54 +0000 |
---|---|---|
committer | Edwin Vane <edwin.vane@intel.com> | 2013-01-31 18:05:54 +0000 |
commit | adc4af6a5b70c31110559bdeb2f3f52646600b90 (patch) | |
tree | 05faa55b1d68063fbbbf485e86995a419421c346 /cmake | |
parent | 86aa95fc2898e288dc356c433006dfe0c6d7bbec (diff) | |
download | external_llvm-adc4af6a5b70c31110559bdeb2f3f52646600b90.zip external_llvm-adc4af6a5b70c31110559bdeb2f3f52646600b90.tar.gz external_llvm-adc4af6a5b70c31110559bdeb2f3f52646600b90.tar.bz2 |
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174073 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/HandleLLVMOptions.cmake | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake index 4e616cb..bb1085c 100644 --- a/cmake/modules/HandleLLVMOptions.cmake +++ b/cmake/modules/HandleLLVMOptions.cmake @@ -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) |