Module: check_mk
Branch: master
Commit: afafa74ab618a219708ba7589185055b1b984257
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=afafa74ab618a2…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Oct 5 08:27:59 2017 +0200
cppcheck is a bit behind the times regarding modern C++ and move semantics.
Let's disable its "passed by value" warnings, they often recommend exactly
the opposite what clang and modern guides propose.
Change-Id: I0f9b337239bc2b98dea14542052a8320e9f2b8c0
---
Makefile | 8 ++++----
livestatus/src/CustomVarsListFilter.cc | 2 --
livestatus/src/HostListFilter.cc | 5 +----
livestatus/src/IntFilter.cc | 2 --
livestatus/src/ListFilter.cc | 2 --
livestatus/src/StringFilter.cc | 2 --
6 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/Makefile b/Makefile
index 6fdb237..63d0ab9 100644
--- a/Makefile
+++ b/Makefile
@@ -489,12 +489,12 @@ cppcheck: compile_commands.json
@scripts/compiled_sources | \
grep /livestatus/src/ |\
sed 's/^"\(.*\)"$$/\1/' | \
- ( cd livestatus && $(CPPCHECK) -DHAVE_CONFIG_H -UCMC --enable=all
--suppress=missingIncludeSystem --suppress=unusedFunction --inline-suppr -I src -I .. -I .
--file-list=- --quiet --template=gcc )
+ ( cd livestatus && $(CPPCHECK) -DHAVE_CONFIG_H -UCMC --enable=all
--suppress=missingIncludeSystem --suppress=unusedFunction --suppress=passedByValue
--inline-suppr -I src -I .. -I . --file-list=- --quiet --template=gcc )
ifeq ($(ENTERPRISE),yes)
@scripts/compiled_sources | \
grep /enterprise/core/ |\
sed 's/^"\(.*\)"$$/\1/' | \
- ( cd enterprise/core/src && $(CPPCHECK) -DHAVE_CONFIG_H -DCMC --enable=all
--suppress=missingIncludeSystem --suppress=unusedFunction --inline-suppr -I . -I ../../..
-I livestatus -I checkhelper --file-list=- --quiet --template=gcc )
+ ( cd enterprise/core/src && $(CPPCHECK) -DHAVE_CONFIG_H -DCMC --enable=all
--suppress=missingIncludeSystem --suppress=unusedFunction --suppress=passedByValue
--inline-suppr -I . -I ../../.. -I livestatus -I checkhelper --file-list=- --quiet
--template=gcc )
endif
# XML output into file intended for machine processing.
@@ -502,12 +502,12 @@ cppcheck-xml: compile_commands.json
scripts/compiled_sources | \
grep /livestatus/src/ |\
sed 's/^"\(.*\)"$$/\1/' | \
- ( cd livestatus && $(CPPCHECK) -DHAVE_CONFIG_H -UCMC --enable=all
--suppress=missingIncludeSystem --suppress=unusedFunction --inline-suppr -I src -I .. -I .
--file-list=- --quiet --template=gcc --xml --xml-version=2 2> cppcheck-result.xml )
+ ( cd livestatus && $(CPPCHECK) -DHAVE_CONFIG_H -UCMC --enable=all
--suppress=missingIncludeSystem --suppress=unusedFunction --suppress=passedByValue
--inline-suppr -I src -I .. -I . --file-list=- --quiet --template=gcc --xml
--xml-version=2 2> cppcheck-result.xml )
ifeq ($(ENTERPRISE),yes)
scripts/compiled_sources | \
grep /enterprise/core/ |\
sed 's/^"\(.*\)"$$/\1/' | \
- ( cd enterprise/core/src && $(CPPCHECK) -DHAVE_CONFIG_H -DCMC --enable=all
--suppress=missingIncludeSystem --suppress=unusedFunction --inline-suppr -I . -I ../../..
-I livestatus -I checkhelper --file-list=- --quiet --template=gcc --xml --xml-version=2
2> cppcheck-result.xml )
+ ( cd enterprise/core/src && $(CPPCHECK) -DHAVE_CONFIG_H -DCMC --enable=all
--suppress=missingIncludeSystem --suppress=unusedFunction --suppress=passedByValue
--inline-suppr -I . -I ../../.. -I livestatus -I checkhelper --file-list=- --quiet
--template=gcc --xml --xml-version=2 2> cppcheck-result.xml )
endif
# TODO: We should probably handle this rule via AM_EXTRA_RECURSIVE_TARGETS in
diff --git a/livestatus/src/CustomVarsListFilter.cc
b/livestatus/src/CustomVarsListFilter.cc
index ad423fe..c27f8ac 100644
--- a/livestatus/src/CustomVarsListFilter.cc
+++ b/livestatus/src/CustomVarsListFilter.cc
@@ -29,10 +29,8 @@
#include "Logger.h"
#include "Row.h"
-// Alas, cppcheck is a bit behind the times regarding move semantics...
CustomVarsListFilter::CustomVarsListFilter(const CustomVarsColumn &column,
RelationalOperator relOp,
- // cppcheck-suppress passedByValue
std::string value)
: _column(column), _relOp(relOp), _ref_text(std::move(value)) {}
diff --git a/livestatus/src/HostListFilter.cc b/livestatus/src/HostListFilter.cc
index 8eed57e..0ce01fe 100644
--- a/livestatus/src/HostListFilter.cc
+++ b/livestatus/src/HostListFilter.cc
@@ -30,11 +30,8 @@
#include "Row.h"
#include "nagios.h"
-// Alas, cppcheck is a bit behind the times regarding move semantics...
HostListFilter::HostListFilter(const HostListColumn &column,
- RelationalOperator relOp,
- // cppcheck-suppress passedByValue
- std::string value)
+ RelationalOperator relOp, std::string value)
: _column(column), _relOp(relOp), _ref_value(std::move(value)) {}
bool HostListFilter::accepts(Row row, const contact * /* auth_user */,
diff --git a/livestatus/src/IntFilter.cc b/livestatus/src/IntFilter.cc
index 559dbf6..42e5100 100644
--- a/livestatus/src/IntFilter.cc
+++ b/livestatus/src/IntFilter.cc
@@ -30,9 +30,7 @@
#include "Logger.h"
#include "Row.h"
-// Alas, cppcheck is a bit behind the times regarding move semantics...
IntFilter::IntFilter(const IntColumn &column, RelationalOperator relOp,
- // cppcheck-suppress passedByValue
std::string value)
: _column(column), _relOp(relOp), _ref_string(std::move(value)) {}
diff --git a/livestatus/src/ListFilter.cc b/livestatus/src/ListFilter.cc
index 9ddcc11..9d85f9e 100644
--- a/livestatus/src/ListFilter.cc
+++ b/livestatus/src/ListFilter.cc
@@ -28,9 +28,7 @@
#include "Logger.h"
#include "Row.h"
-// Alas, cppcheck is a bit behind the times regarding move semantics...
ListFilter::ListFilter(const ListColumn &column, RelationalOperator relOp,
- // cppcheck-suppress passedByValue
std::string element,
std::unique_ptr<ListColumn::Contains> predicate,
bool isEmptyValue)
diff --git a/livestatus/src/StringFilter.cc b/livestatus/src/StringFilter.cc
index 6cd77af..ae3ee6e 100644
--- a/livestatus/src/StringFilter.cc
+++ b/livestatus/src/StringFilter.cc
@@ -29,9 +29,7 @@
#include "Row.h"
#include "StringColumn.h"
-// Alas, cppcheck is a bit behind the times regarding move semantics...
StringFilter::StringFilter(const StringColumn &column, RelationalOperator relOp,
- // cppcheck-suppress passedByValue
std::string value)
: _column(column), _relOp(relOp), _ref_string(std::move(value)) {
switch (_relOp) {