diff options
| author | Aaron Puchert <aaronpuchert@alice-dsl.net> | 2018-03-24 18:17:35 +0100 |
|---|---|---|
| committer | Aaron Puchert <aaronpuchert@alice-dsl.net> | 2018-03-24 19:03:28 +0100 |
| commit | e2eaded47068c7b87bc112609eb77afab18665aa (patch) | |
| tree | 3b19ba84e8bea377de079dc1f40ab3215981f922 | |
| parent | 19aef5185f5b39f6c90956da146d26eba142d2a0 (diff) | |
| download | PROJ-e2eaded47068c7b87bc112609eb77afab18665aa.tar.gz PROJ-e2eaded47068c7b87bc112609eb77afab18665aa.zip | |
Don't set -std=c89 in CMakeLists.txt
This allows us to take advantage of newer features when they are
available. However, builds on Travis still use -std=c89 to ensure C89
compatibility. Locally this can be achieved with either
* cmake -DCMAKE_C_STANDARD=90 ..
* cmake -DCMAKE_C_FLAGS='-std=c89' ..
* C_FLAGS='-std=c89' cmake ..
We also reorder the warning flags: they are all part of the standard
build now, but -Werror is only applied on Travis.
Fixes #892.
| -rw-r--r-- | CMakeLists.txt | 16 | ||||
| -rw-r--r-- | appveyor.yml | 3 | ||||
| -rwxr-xr-x | travis/linux_clang/install.sh | 2 | ||||
| -rwxr-xr-x | travis/linux_gcc/install.sh | 3 |
4 files changed, 12 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e6f56788..a9ca82d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,19 +18,21 @@ set(PROJECT_INTERN_NAME PROJ) if (NOT CMAKE_VERSION VERSION_LESS 3.1) cmake_policy(SET CMP0054 NEW) endif () + # Set warnings if("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") + # Suppress warning 4706 about assignment within conditional expression # Suppress warning 4996 about sprintf, etc., being unsafe - set(CMAKE_C_FLAGS "/wd4996 /WX ${CMAKE_C_FLAGS}") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4 /wd4706 /wd4996 \ + /D_CRT_SECURE_NO_WARNINGS") elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") - set(CMAKE_C_FLAGS "-std=c89 -Wall -Wextra -Wswitch -Werror \ + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wswitch -Wshadow \ -Wunused-parameter -Wmissing-prototypes -Wmissing-declarations -Wformat \ - -Werror=format-security -Wshadow ${CMAKE_C_FLAGS}") + -Wformat-security") elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") - set(CMAKE_C_FLAGS "-std=c89 -Wall -Wextra -Wswitch -Werror \ - -Wc99-extensions -Wc11-extensions -Wunused-parameter -Wmissing-prototypes \ - -Wmissing-declarations -Wformat -Werror=format-security -Wshadow \ - -Wfloat-conversion ${CMAKE_C_FLAGS}") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wswitch -Wshadow \ + -Wunused-parameter -Wmissing-prototypes -Wmissing-declarations -Wformat \ + -Wformat-security -Wfloat-conversion -Wc99-extensions -Wc11-extensions") endif() # Tell Intel compiler to do arithmetic accurately. This is needed to diff --git a/appveyor.yml b/appveyor.yml index e7e46265..a6284f9e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -50,8 +50,7 @@ build_script: - if "%BUILD_TYPE%" == "cmake" if "%platform%" == "x64" SET VS_FULL=%VS_VERSION% Win64 - if "%BUILD_TYPE%" == "cmake" if "%platform%" == "x86" SET VS_FULL=%VS_VERSION% - if "%BUILD_TYPE%" == "cmake" echo "%VS_FULL%" -# warning C4706: assignment within conditional expression - - if "%BUILD_TYPE%" == "cmake" cmake -G "%VS_FULL%" . -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=../bin -DBUILD_LIBPROJ_SHARED=ON -DCMAKE_C_FLAGS="/W4 /wd4706 /WX /D_CRT_SECURE_NO_WARNINGS" + - if "%BUILD_TYPE%" == "cmake" cmake -G "%VS_FULL%" . -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=../bin -DBUILD_LIBPROJ_SHARED=ON -DCMAKE_C_FLAGS="/WX" - if "%BUILD_TYPE%" == "cmake" cmake --build . --config Release test_script: diff --git a/travis/linux_clang/install.sh b/travis/linux_clang/install.sh index cacb3f85..32ce30f0 100755 --- a/travis/linux_clang/install.sh +++ b/travis/linux_clang/install.sh @@ -4,4 +4,4 @@ set -e export CCACHE_CPP2=yes -CC="ccache clang" CFLAGS="-std=c89 -g -Wall -Wextra -Werror -Wunused-parameter -Wmissing-prototypes -Wmissing-declarations -Wformat -Werror=format-security -Wshadow -Wfloat-conversion -fsanitize=address -O2" ./travis/install.sh +CC="ccache clang" CFLAGS="-std=c89 -Werror -fsanitize=address" ./travis/install.sh diff --git a/travis/linux_gcc/install.sh b/travis/linux_gcc/install.sh index 6910322c..77e9a2e3 100755 --- a/travis/linux_gcc/install.sh +++ b/travis/linux_gcc/install.sh @@ -4,5 +4,4 @@ set -e export CCACHE_CPP2=yes -# -Wfloat-conversion not available for gcc 4.8 -CC="ccache gcc" CFLAGS="-std=c89 -g -Wall -Wextra -Werror -Wunused-parameter -Wmissing-prototypes -Wmissing-declarations -Wformat -Werror=format-security -Wshadow -O2" ./travis/install.sh +CC="ccache gcc" CFLAGS="-std=c89 -Werror" ./travis/install.sh |
