minor improvements (#1929)

* lib: isNonBoolStdType no longer needed

lib/checkbool.cpp:50:13: warning: unused function 'isNonBoolStdType'
      [-Wunused-function]
static bool isNonBoolStdType(const Variable* var)

* cmake: C++11 is required

also change instructions to a more common syntax
This commit is contained in:
Carlo Marcelo Arenas Belón 2019-06-27 21:57:05 -07:00 committed by Daniel Marjamäki
parent 243db9b69a
commit ec4e43767e
5 changed files with 23 additions and 16 deletions

View File

@ -9,6 +9,9 @@ include(cmake/findDependencies.cmake REQUIRED)
include(cmake/compileroptions.cmake REQUIRED)
include(cmake/compilerDefinitions.cmake REQUIRED)
include(cmake/buildFiles.cmake REQUIRED)
include(cmake/cxx11.cmake REQUIRED)
use_cxx11()
file(GLOB cfgs "cfg/*.cfg")

14
cmake/cxx11.cmake Normal file
View File

@ -0,0 +1,14 @@
macro(use_cxx11)
if (CMAKE_VERSION VERSION_LESS "3.1")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif ()
else ()
set (CMAKE_CXX_STANDARD 11)
if (POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif ()
endif ()
endmacro(use_cxx11)

View File

@ -47,10 +47,6 @@ static bool isBool(const Variable* var)
{
return (var && Token::Match(var->typeEndToken(), "bool|_Bool"));
}
static bool isNonBoolStdType(const Variable* var)
{
return (var && var->typeEndToken()->isStandardType() && !Token::Match(var->typeEndToken(), "bool|_Bool"));
}
//---------------------------------------------------------------------------
void CheckBool::checkIncrementBoolean()

View File

@ -36,15 +36,12 @@ There are multiple compilation choices:
Example, compiling Cppcheck with cmake:
```shell
mkdir b
cd b
mkdir build
cd build
cmake ..
make
cmake --build .
```
If you need to specify c++ standard you can do it with the option
-DCMAKE_CXX_STANDARD=11
If you want to compile the GUI you can use the flag
-DBUILD_GUI=ON

View File

@ -34,13 +34,10 @@ Compiling
cmake
=====
Example, compiling Cppcheck with cmake:
mkdir b
cd b
mkdir build
cd build
cmake ..
make
If you need to specify c++ standard you can do it with the option
-DCMAKE_CXX_STANDARD=11
cmake --build .
If you want to compile the GUI you can use the flag
-DBUILD_GUI=ON