From a15a227b737583d740580eeffc723f505e561db2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Sat, 5 Feb 2022 17:57:32 +0100 Subject: [PATCH] bumped minimum supported GCC version to 4.8 (#3768) --- CMakeLists.txt | 1 + cli/main.cpp | 16 ---------------- cmake/compilerCheck.cmake | 14 ++++++++++++++ cmake/compileroptions.cmake | 4 ---- philosophy.md | 4 ++-- readme.md | 4 ++-- readme.txt | 4 ++-- readmeja.md | 4 ++-- 8 files changed, 23 insertions(+), 28 deletions(-) create mode 100644 cmake/compilerCheck.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index fbc0c9ef7..2b78262cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) include(GNUInstallDirs) +include(cmake/compilerCheck.cmake) include(cmake/versions.cmake) include(cmake/options.cmake) include(cmake/findDependencies.cmake) diff --git a/cli/main.cpp b/cli/main.cpp index 7b3bcb6aa..ca48497d2 100644 --- a/cli/main.cpp +++ b/cli/main.cpp @@ -112,19 +112,3 @@ int main(int argc, char* argv[]) #endif // *INDENT-ON* } - - -// Warn about deprecated compilers -#ifdef __clang__ -# if (__clang_major__ < 2 || (__clang_major__ == 2 && __clang_minor__ < 9)) -# warning "Using Clang 2.8 or earlier. Support for this version has been removed." -# endif -#elif defined(__GNUC__) -# if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)) -# warning "Using GCC 4.5 or earlier. Support for this version has been removed." -# endif -#elif defined(_MSC_VER) -# if (_MSC_VER < 1800) -# pragma message("WARNING: Using Visual Studio 2012 or earlier. Support for this version has been removed.") -# endif -#endif diff --git a/cmake/compilerCheck.cmake b/cmake/compilerCheck.cmake new file mode 100644 index 000000000..62308d674 --- /dev/null +++ b/cmake/compilerCheck.cmake @@ -0,0 +1,14 @@ +if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) + message(ERROR "GCC >= 4.8 required - detected ${CMAKE_CXX_COMPILER_VERSION} not supported") + endif () +elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # TODO: verify this + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.9) + message(ERROR "Clang >= 2.9 required - detected ${CMAKE_CXX_COMPILER_VERSION} not supported") + endif () +elseif(MSVC) + if (MSVC_VERSION VERSION_LESS 1800) + message(ERROR "Visual Studio >= 2013 (1800) required - detected ${MSVC_VERSION} not supported") + endif () +endif() diff --git a/cmake/compileroptions.cmake b/cmake/compileroptions.cmake index 394176274..c5235f357 100644 --- a/cmake/compileroptions.cmake +++ b/cmake/compileroptions.cmake @@ -46,10 +46,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" endif() if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6) - message(FATAL_ERROR "${PROJECT_NAME} c++11 support requires g++ 4.6 or greater, but it is ${CMAKE_CXX_COMPILER_VERSION}") - endif () - add_compile_options(-Woverloaded-virtual) # when a function declaration hides virtual functions from a base class add_compile_options(-Wno-maybe-uninitialized) # there are some false positives add_compile_options(-Wsuggest-attribute=noreturn) diff --git a/philosophy.md b/philosophy.md index d9418a152..18d496d21 100644 --- a/philosophy.md +++ b/philosophy.md @@ -56,9 +56,9 @@ This is not just a tool for mainstream gcc/msvc c/c++ developers. If you can com ## C++ language -Our goal is to be highly portable. Users must be able to compile Cppcheck with GCC 4.6 or MSVS 2013. +Our goal is to be highly portable. Users must be able to compile Cppcheck with GCC 4.8 or Visual Studio 2013. -No C++14 is allowed. A subset of the C++11 is allowed. +No C++14 is allowed. A subset of C++11 is allowed. ## Avoid dependencies diff --git a/readme.md b/readme.md index 2c834ad9f..ddb507393 100644 --- a/readme.md +++ b/readme.md @@ -27,7 +27,7 @@ You can stop the script whenever you like with Ctrl C. ## Compiling -Any C++11 compiler should work. For compilers with partial C++11 support it may work. If your compiler has the C++11 features that are available in Visual Studio 2013 / GCC 4.6 then it will work. +Any C++11 compiler should work. For compilers with partial C++11 support it may work. If your compiler has the C++11 features that are available in Visual Studio 2013 / GCC 4.8 then it will work. To build the GUI, you need Qt. @@ -39,7 +39,7 @@ There are multiple compilation choices: * Windows: Visual Studio (VS 2013 and above) * Windows: Qt Creator + mingw * gnu make -* g++ 4.6 (or later) +* g++ 4.8 (or later) * clang++ ### cmake diff --git a/readme.txt b/readme.txt index 1e498a11e..5db9da769 100644 --- a/readme.txt +++ b/readme.txt @@ -15,7 +15,7 @@ Manual Compiling Any C++11 compiler should work. For compilers with partial C++11 support it may work. If - your compiler has the C++11 features that are available in Visual Studio 2013 / GCC 4.6 + your compiler has the C++11 features that are available in Visual Studio 2013 / GCC 4.8 then it will work. To build the GUI, you need Qt. @@ -36,7 +36,7 @@ Compiling * Windows: Visual Studio * Windows: Qt Creator + mingw * gnu make - * g++ 4.6 (or later) + * g++ 4.8 (or later) * clang++ cmake diff --git a/readmeja.md b/readmeja.md index 0f8476d3f..45548bbe6 100644 --- a/readmeja.md +++ b/readmeja.md @@ -16,7 +16,7 @@ ## ビルド -C++11に対応したコンパイラが利用できます。部分的にC++11にサポートしたコンパイラも利用できるかもしれません。もし、あなたのコンパイラがVisual Studio 2013や GCC 4.6で利用できるC++11機能がサポートされているなら、そのコンパイラが利用できます。 +C++11に対応したコンパイラが利用できます。部分的にC++11にサポートしたコンパイラも利用できるかもしれません。もし、あなたのコンパイラがVisual Studio 2013や GCC 4.8で利用できるC++11機能がサポートされているなら、そのコンパイラが利用できます。 GUIも利用する場合、Qtライブラリが必要です。 @@ -28,7 +28,7 @@ GUIも利用する場合、Qtライブラリが必要です。 * Windows: Visual Studio (VS 2013 またはそれ以上) * Windows: Qt Creator + mingw * gnu make -* g++ 4.6 (またはそれ以上) +* g++ 4.8 (またはそれ以上) * clang++ ### cmake