diff --git a/CMakeLists.txt b/CMakeLists.txt index 3595154f7ae..8b606995cbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,8 @@ project(Cppcheck VERSION 2.18.99 LANGUAGES CXX) include(cmake/options.cmake) -include(cmake/cxx11.cmake) -use_cxx11() +include(cmake/cxx17.cmake) +use_cxx17() set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/cmake/cxx11.cmake b/cmake/cxx11.cmake deleted file mode 100644 index 2deba34edaa..00000000000 --- a/cmake/cxx11.cmake +++ /dev/null @@ -1,8 +0,0 @@ -macro(use_cxx11) - if(USE_BOOST AND USE_BOOST_INT128) - # Boost.Math requires C++14 - set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to use") - else() - set(CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard to use") - endif() -endmacro() diff --git a/cmake/cxx17.cmake b/cmake/cxx17.cmake new file mode 100644 index 00000000000..2f3254812a9 --- /dev/null +++ b/cmake/cxx17.cmake @@ -0,0 +1,3 @@ +macro(use_cxx17) + set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to use") +endmacro() diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 7a637c8b7b3..643edf44be7 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -874,7 +874,7 @@ std::size_t CppCheck::calculateHash(const Preprocessor& preprocessor, const std: unsigned int CppCheck::checkBuffer(const FileWithDetails &file, const std::string &cfgname, int fileIndex, const uint8_t* data, std::size_t size) { const auto f = [&file, data, size](std::vector& files, simplecpp::OutputList* outputList) { - return simplecpp::TokenList{data, size, files, file.spath(), outputList}; + return simplecpp::TokenList{static_cast(data), size, files, file.spath(), outputList}; }; return checkInternal(file, cfgname, fileIndex, f); } diff --git a/man/manual-premium.md b/man/manual-premium.md index 9f2e5992537..f3a0a71670b 100644 --- a/man/manual-premium.md +++ b/man/manual-premium.md @@ -15,7 +15,7 @@ if it has non-standard syntax, as is common in for example embedded projects. Supported code and platforms: - Cppcheck checks non-standard code that contains various compiler extensions, inline assembly code, etc. -- Cppcheck should be compilable by any compiler that supports C++11 or later. +- Cppcheck should be compilable by any compiler that supports C++17 or later. - Cppcheck is cross platform and is used in various posix/windows/etc environments. The checks in Cppcheck are not perfect. There are bugs that should be found, that Cppcheck fails to detect. diff --git a/man/manual.md b/man/manual.md index d8da119f388..7a7f87ce1cc 100644 --- a/man/manual.md +++ b/man/manual.md @@ -16,7 +16,7 @@ if it has non-standard syntax, as is common in for example embedded projects. Supported code and platforms: - Cppcheck checks non-standard code that contains various compiler extensions, inline assembly code, etc. -- Cppcheck should be compilable by any compiler that supports C++11 or later. +- Cppcheck should be compilable by any compiler that supports C++17 or later. - Cppcheck is cross platform and is used in various posix/windows/etc environments. The checks in Cppcheck are not perfect. There are bugs that should be found, that Cppcheck fails to detect. diff --git a/philosophy.md b/philosophy.md index af61a1cd38f..4c8a0333303 100644 --- a/philosophy.md +++ b/philosophy.md @@ -51,10 +51,7 @@ 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.8 or Visual Studio 2013. - -No C++14 is allowed. A subset of C++11 is allowed. - +Our goal is to be highly portable. Users must be able to compile Cppcheck with the default compiler of supported Debian/Ubuntu/Windows versions. ## Avoid dependencies diff --git a/readme.md b/readme.md index a902f9fd2ef..fd29690d629 100644 --- a/readme.md +++ b/readme.md @@ -34,7 +34,7 @@ You can stop the script whenever you like with Ctrl C. ## Compiling -Cppcheck requires a C++ compiler with (partial) C++11 support. Minimum required versions are GCC 5.1 / Clang 3.5 / Visual Studio 2015. +Cppcheck requires a C++ compiler with C++17 support. Minimum required versions are GCC 7 / Clang 5 / Visual Studio 2017. To build the GUI application, you need to use the CMake build system. @@ -197,7 +197,7 @@ make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes CXXOPTS="-O2" If you just want to build Cppcheck without dependencies then you can use this command: ```shell -g++ -o cppcheck -std=c++11 -Iexternals -Iexternals/simplecpp -Iexternals/tinyxml2 -Iexternals/picojson -Ilib -Ifrontend frontend/*.cpp cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml2/tinyxml2.cpp +g++ -o cppcheck -std=c++17 -Iexternals -Iexternals/simplecpp -Iexternals/tinyxml2 -Iexternals/picojson -Ilib -Ifrontend frontend/*.cpp cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml2/tinyxml2.cpp ``` #### Flags