diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-11-23 07:45:52 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-11-23 09:43:55 +0300 |
commit | 4fe413a419e2baf23b835bbf1b9739de40c624de (patch) | |
tree | 5b78cd159741cad10a9b3fd0deb9699d71782b37 /CMakeLists.txt | |
parent | 64ab45213166b62d177e4e0f831a0b84ec2c463b (diff) |
CMake: use -Wshadow warning for C source
C source now builds without shadowing, enable with GCC by default.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7319a34d11b..507676667c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2602,6 +2602,11 @@ if(CMAKE_COMPILER_IS_GNUCC) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_REDUNDANT_DECLS -Wredundant-decls) endif() + # versions before gcc4.8 include global name-space. + if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.8") + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_SHADOW -Wshadow) + endif() + # disable because it gives warnings for printf() & friends. # ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion) |