Skip to content

Commit

Permalink
minor improvements (danmar#1929)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
carenas authored and danmar committed Jun 28, 2019
1 parent 243db9b commit ec4e437
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
14 changes: 14 additions & 0 deletions cmake/cxx11.cmake
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 0 additions & 4 deletions lib/checkbool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
9 changes: 3 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 3 additions & 6 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ec4e437

Please sign in to comment.