small utils.h cleanup (#3821)

This commit is contained in:
Oliver Stöneberg 2022-02-11 19:44:08 +01:00 committed by GitHub
parent 5f3ddabd56
commit 6e57cc4323
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 56 additions and 67 deletions

View File

@ -522,7 +522,7 @@ $(libcppdir)/forwardanalyzer.o: lib/forwardanalyzer.cpp lib/analyzer.h lib/astut
$(libcppdir)/importproject.o: lib/importproject.cpp externals/picojson/picojson.h externals/tinyxml2/tinyxml2.h lib/config.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h $(libcppdir)/importproject.o: lib/importproject.cpp externals/picojson/picojson.h externals/tinyxml2/tinyxml2.h lib/config.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/importproject.o $(libcppdir)/importproject.cpp $(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/importproject.o $(libcppdir)/importproject.cpp
$(libcppdir)/infer.o: lib/infer.cpp lib/calculate.h lib/config.h lib/errortypes.h lib/infer.h lib/mathlib.h lib/utils.h lib/valueflow.h lib/valueptr.h $(libcppdir)/infer.o: lib/infer.cpp lib/calculate.h lib/config.h lib/errortypes.h lib/infer.h lib/mathlib.h lib/valueflow.h lib/valueptr.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/infer.o $(libcppdir)/infer.cpp $(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/infer.o $(libcppdir)/infer.cpp
$(libcppdir)/library.o: lib/library.cpp externals/tinyxml2/tinyxml2.h lib/astutils.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/path.h lib/standards.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenlist.h lib/utils.h lib/valueflow.h $(libcppdir)/library.o: lib/library.cpp externals/tinyxml2/tinyxml2.h lib/astutils.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/path.h lib/standards.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenlist.h lib/utils.h lib/valueflow.h
@ -540,7 +540,7 @@ $(libcppdir)/pathanalysis.o: lib/pathanalysis.cpp lib/astutils.h lib/config.h li
$(libcppdir)/pathmatch.o: lib/pathmatch.cpp lib/config.h lib/path.h lib/pathmatch.h lib/utils.h $(libcppdir)/pathmatch.o: lib/pathmatch.cpp lib/config.h lib/path.h lib/pathmatch.h lib/utils.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/pathmatch.o $(libcppdir)/pathmatch.cpp $(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/pathmatch.o $(libcppdir)/pathmatch.cpp
$(libcppdir)/platform.o: lib/platform.cpp externals/tinyxml2/tinyxml2.h lib/config.h lib/path.h lib/platform.h lib/utils.h $(libcppdir)/platform.o: lib/platform.cpp externals/tinyxml2/tinyxml2.h lib/config.h lib/path.h lib/platform.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/platform.o $(libcppdir)/platform.cpp $(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/platform.o $(libcppdir)/platform.cpp
$(libcppdir)/preprocessor.o: lib/preprocessor.cpp externals/simplecpp/simplecpp.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/utils.h $(libcppdir)/preprocessor.o: lib/preprocessor.cpp externals/simplecpp/simplecpp.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/utils.h
@ -633,7 +633,7 @@ test/testcharvar.o: test/testcharvar.cpp lib/check.h lib/checkother.h lib/color.
test/testclangimport.o: test/testclangimport.cpp lib/clangimport.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h test/testclangimport.o: test/testclangimport.cpp lib/clangimport.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testclangimport.o test/testclangimport.cpp $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testclangimport.o test/testclangimport.cpp
test/testclass.o: test/testclass.cpp externals/tinyxml2/tinyxml2.h lib/check.h lib/checkclass.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h test/testclass.o: test/testclass.cpp externals/tinyxml2/tinyxml2.h lib/check.h lib/checkclass.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testclass.o test/testclass.cpp $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testclass.o test/testclass.cpp
test/testcmdlineparser.o: test/testcmdlineparser.cpp cli/cmdlineparser.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/utils.h test/redirect.h test/testsuite.h test/testcmdlineparser.o: test/testcmdlineparser.cpp cli/cmdlineparser.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/utils.h test/redirect.h test/testsuite.h
@ -642,7 +642,7 @@ test/testcmdlineparser.o: test/testcmdlineparser.cpp cli/cmdlineparser.h lib/col
test/testcondition.o: test/testcondition.cpp externals/simplecpp/simplecpp.h externals/tinyxml2/tinyxml2.h lib/check.h lib/checkcondition.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h test/testcondition.o: test/testcondition.cpp externals/simplecpp/simplecpp.h externals/tinyxml2/tinyxml2.h lib/check.h lib/checkcondition.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testcondition.o test/testcondition.cpp $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testcondition.o test/testcondition.cpp
test/testconstructors.o: test/testconstructors.cpp lib/check.h lib/checkclass.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h test/testconstructors.o: test/testconstructors.cpp lib/check.h lib/checkclass.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testconstructors.o test/testconstructors.cpp $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testconstructors.o test/testconstructors.cpp
test/testcppcheck.o: test/testcppcheck.cpp lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/utils.h test/testsuite.h test/testcppcheck.o: test/testcppcheck.cpp lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/utils.h test/testsuite.h
@ -705,7 +705,7 @@ test/testpath.o: test/testpath.cpp lib/color.h lib/config.h lib/errorlogger.h li
test/testpathmatch.o: test/testpathmatch.cpp lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/pathmatch.h lib/suppressions.h test/testsuite.h test/testpathmatch.o: test/testpathmatch.cpp lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/pathmatch.h lib/suppressions.h test/testsuite.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testpathmatch.o test/testpathmatch.cpp $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testpathmatch.o test/testpathmatch.cpp
test/testplatform.o: test/testplatform.cpp externals/tinyxml2/tinyxml2.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/platform.h lib/suppressions.h lib/utils.h test/testsuite.h test/testplatform.o: test/testplatform.cpp externals/tinyxml2/tinyxml2.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/platform.h lib/suppressions.h test/testsuite.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testplatform.o test/testplatform.cpp $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testplatform.o test/testplatform.cpp
test/testpostfixoperator.o: test/testpostfixoperator.cpp lib/check.h lib/checkpostfixoperator.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h test/testpostfixoperator.o: test/testpostfixoperator.cpp lib/check.h lib/checkpostfixoperator.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
@ -777,7 +777,7 @@ test/testuninitvar.o: test/testuninitvar.cpp lib/check.h lib/checkuninitvar.h li
test/testunusedfunctions.o: test/testunusedfunctions.cpp lib/check.h lib/checkunusedfunctions.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h test/testunusedfunctions.o: test/testunusedfunctions.cpp lib/check.h lib/checkunusedfunctions.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testunusedfunctions.o test/testunusedfunctions.cpp $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testunusedfunctions.o test/testunusedfunctions.cpp
test/testunusedprivfunc.o: test/testunusedprivfunc.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkclass.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h test/testunusedprivfunc.o: test/testunusedprivfunc.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkclass.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testunusedprivfunc.o test/testunusedprivfunc.cpp $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testunusedprivfunc.o test/testunusedprivfunc.cpp
test/testunusedvar.o: test/testunusedvar.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkunusedvar.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h test/testunusedvar.o: test/testunusedvar.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkunusedvar.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h

View File

@ -339,10 +339,10 @@ static void print_stacktrace(FILE* output, bool demangling, int maxdepth, bool l
} }
#undef ADDRESSDISPLAYLENGTH #undef ADDRESSDISPLAYLENGTH
#else #else
UNUSED(output); (void)output;
UNUSED(demangling); (void)demangling;
UNUSED(maxdepth); (void)maxdepth;
UNUSED(lowMem); (void)lowMem;
#endif #endif
} }
@ -410,7 +410,7 @@ static void CppcheckSignalHandler(int signo, siginfo_t * info, void * context)
type = (int)uc->uc_mcontext.gregs[REG_ERR] & 2; type = (int)uc->uc_mcontext.gregs[REG_ERR] & 2;
} }
#else #else
UNUSED(context); (void)context;
killid = getpid(); killid = getpid();
#endif #endif

View File

@ -217,7 +217,8 @@ static std::string addFiles2(std::map<std::string, std::size_t> &files,
dirent entry; dirent entry;
char buf[sizeof(*dir_result) + (sizeof(dir_result->d_name) > 1 ? 0 : NAME_MAX + 1)]; char buf[sizeof(*dir_result) + (sizeof(dir_result->d_name) > 1 ? 0 : NAME_MAX + 1)];
} dir_result_buffer; } dir_result_buffer;
UNUSED(dir_result_buffer.buf); // do not trigger cppcheck itself on the "unused buf" // TODO: suppress instead?
(void)dir_result_buffer.buf; // do not trigger cppcheck itself on the "unused buf"
std::string new_path; std::string new_path;
new_path.reserve(path.length() + 100);// prealloc some memory to avoid constant new/deletes in loop new_path.reserve(path.length() + 100);// prealloc some memory to avoid constant new/deletes in loop

View File

@ -28,6 +28,7 @@
#include "settings.h" #include "settings.h"
#include "symboldatabase.h" #include "symboldatabase.h"
#include "token.h" #include "token.h"
#include "utils.h"
#include "valueflow.h" #include "valueflow.h"
#include "valueptr.h" #include "valueptr.h"

View File

@ -27,8 +27,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "config.h"
#include "errortypes.h" #include "errortypes.h"
#include "utils.h"
class Function; class Function;
class Library; class Library;

View File

@ -28,7 +28,6 @@
#include "symboldatabase.h" #include "symboldatabase.h"
#include "token.h" #include "token.h"
#include "tokenize.h" #include "tokenize.h"
#include "utils.h"
#include "valueflow.h" #include "valueflow.h"
#include <algorithm> #include <algorithm>

View File

@ -28,7 +28,6 @@
#include "errortypes.h" #include "errortypes.h"
#include "mathlib.h" #include "mathlib.h"
#include "symboldatabase.h" #include "symboldatabase.h"
#include "utils.h"
#include "valueflow.h" #include "valueflow.h"
#include <list> #include <list>

View File

@ -23,9 +23,7 @@
#include "check.h" #include "check.h"
#include "config.h" #include "config.h"
#include "symboldatabase.h"
#include "tokenize.h" #include "tokenize.h"
#include "utils.h"
#include <cstddef> #include <cstddef>
#include <list> #include <list>
@ -37,6 +35,11 @@
class ErrorLogger; class ErrorLogger;
class Settings; class Settings;
class Token; class Token;
class Function;
class Scope;
class SymbolDatabase;
class Type;
class Variable;
namespace CTU { namespace CTU {
class FileInfo; class FileInfo;

View File

@ -26,7 +26,6 @@
#include "config.h" #include "config.h"
#include "mathlib.h" #include "mathlib.h"
#include "errortypes.h" #include "errortypes.h"
#include "utils.h"
#include <set> #include <set>
#include <string> #include <string>

View File

@ -27,7 +27,6 @@
#include "errortypes.h" #include "errortypes.h"
#include "library.h" #include "library.h"
#include "settings.h" #include "settings.h"
#include "utils.h"
#include <map> #include <map>
#include <string> #include <string>

View File

@ -25,7 +25,6 @@
#include "symboldatabase.h" #include "symboldatabase.h"
#include "token.h" #include "token.h"
#include "tokenize.h" #include "tokenize.h"
#include "utils.h"
#include "valueflow.h" #include "valueflow.h"
#include <algorithm> #include <algorithm>

View File

@ -24,7 +24,6 @@
#include "check.h" #include "check.h"
#include "config.h" #include "config.h"
#include "errortypes.h" #include "errortypes.h"
#include "utils.h"
#include <ostream> #include <ostream>
#include <string> #include <string>

View File

@ -25,7 +25,6 @@
#include "check.h" #include "check.h"
#include "config.h" #include "config.h"
#include "library.h" #include "library.h"
#include "utils.h"
#include <map> #include <map>
#include <set> #include <set>

View File

@ -26,7 +26,6 @@
#include "symboldatabase.h" #include "symboldatabase.h"
#include "token.h" #include "token.h"
#include "tokenize.h" #include "tokenize.h"
#include "utils.h"
#include <algorithm> #include <algorithm>
#include <unordered_set> #include <unordered_set>

View File

@ -36,7 +36,6 @@
#include "config.h" #include "config.h"
#include "errortypes.h" #include "errortypes.h"
#include "tokenize.h" #include "tokenize.h"
#include "utils.h"
#include <list> #include <list>
#include <string> #include <string>

View File

@ -28,7 +28,6 @@
#include "symboldatabase.h" #include "symboldatabase.h"
#include "token.h" #include "token.h"
#include "tokenize.h" #include "tokenize.h"
#include "utils.h"
#include "valueflow.h" #include "valueflow.h"
#include "checkuninitvar.h" // CheckUninitVar::isVariableUsage #include "checkuninitvar.h" // CheckUninitVar::isVariableUsage
@ -41,6 +40,7 @@
#include <memory> #include <memory>
#include <ostream> #include <ostream>
#include <set> #include <set>
#include <type_traits>
#include <utility> #include <utility>
#include <numeric> #include <numeric>

View File

@ -25,7 +25,6 @@
#include "check.h" #include "check.h"
#include "config.h" #include "config.h"
#include "errortypes.h" #include "errortypes.h"
#include "utils.h"
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -26,7 +26,6 @@
#include "config.h" #include "config.h"
#include "errortypes.h" #include "errortypes.h"
#include "tokenize.h" #include "tokenize.h"
#include "utils.h"
#include "valueflow.h" #include "valueflow.h"
#include <string> #include <string>

View File

@ -27,7 +27,6 @@
#include "ctu.h" #include "ctu.h"
#include "mathlib.h" #include "mathlib.h"
#include "errortypes.h" #include "errortypes.h"
#include "utils.h"
#include "valueflow.h" #include "valueflow.h"
#include <list> #include <list>

View File

@ -69,4 +69,30 @@
#include <string> #include <string>
static const std::string emptyString; static const std::string emptyString;
// Use the nonneg macro when you want to assert that a variable/argument is not negative
#ifdef __CPPCHECK__
#define nonneg __cppcheck_low__(0)
#elif defined(NONNEG)
// Enable non-negative values checking
// TODO : investigate using annotations/contracts for stronger value checking
#define nonneg unsigned
#else
// Disable non-negative values checking
#define nonneg
#endif
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
#define ASAN 1
#endif
#endif
#ifndef ASAN
#ifdef __SANITIZE_ADDRESS__
#define ASAN 1
#else
#define ASAN 0
#endif
#endif
#endif // configH #endif // configH

View File

@ -27,6 +27,7 @@
#include "token.h" #include "token.h"
#include "tokenize.h" #include "tokenize.h"
#include "tokenlist.h" #include "tokenlist.h"
#include "utils.h"
#include <cstdint> #include <cstdint>
#include <cstring> #include <cstring>

View File

@ -26,7 +26,6 @@
#include "check.h" #include "check.h"
#include "errorlogger.h" #include "errorlogger.h"
#include "mathlib.h" #include "mathlib.h"
#include "utils.h"
#include "valueflow.h" #include "valueflow.h"
#include <algorithm> #include <algorithm>

View File

@ -24,7 +24,6 @@
#include "path.h" #include "path.h"
#include "token.h" #include "token.h"
#include "tokenlist.h" #include "tokenlist.h"
#include "utils.h"
#include <algorithm> #include <algorithm>
#include <array> #include <array>

View File

@ -142,7 +142,6 @@
#include "token.h" #include "token.h"
#include "tokenize.h" #include "tokenize.h"
#include "tokenlist.h" #include "tokenlist.h"
#include "utils.h"
#include <cctype> #include <cctype>
#include <climits> #include <climits>

View File

@ -20,7 +20,6 @@
#include "path.h" #include "path.h"
#include <algorithm>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <limits> #include <limits>

View File

@ -22,7 +22,6 @@
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#include "config.h" #include "config.h"
#include "utils.h"
#include <climits> #include <climits>
#include <string> #include <string>

View File

@ -26,6 +26,7 @@
#include "settings.h" #include "settings.h"
#include "symboldatabase.h" #include "symboldatabase.h"
#include "token.h" #include "token.h"
#include "utils.h"
#include "valueflow.h" #include "valueflow.h"
#include "valueptr.h" #include "valueptr.h"
@ -35,6 +36,7 @@
#include <list> #include <list>
#include <memory> #include <memory>
#include <string> #include <string>
#include <type_traits>
#include <utility> #include <utility>
#include <vector> #include <vector>

View File

@ -19,9 +19,12 @@
#ifndef GUARD_PROGRAMMEMORY_H #ifndef GUARD_PROGRAMMEMORY_H
#define GUARD_PROGRAMMEMORY_H #define GUARD_PROGRAMMEMORY_H
#include "config.h"
#include "mathlib.h" #include "mathlib.h"
#include "utils.h"
#include "valueflow.h" // needed for alias #include "valueflow.h" // needed for alias
#include <cstddef>
#include <functional>
#include <map> #include <map>
#include <unordered_map> #include <unordered_map>

View File

@ -42,6 +42,7 @@
#include <limits> #include <limits>
#include <stack> #include <stack>
#include <string> #include <string>
#include <type_traits>
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@ -25,7 +25,6 @@
#include "library.h" #include "library.h"
#include "mathlib.h" #include "mathlib.h"
#include "token.h" #include "token.h"
#include "utils.h"
#include <cctype> #include <cctype>
#include <iosfwd> #include <iosfwd>
@ -34,7 +33,6 @@
#include <memory> #include <memory>
#include <set> #include <set>
#include <string> #include <string>
#include <type_traits>
#include <utility> #include <utility>
#include <vector> #include <vector>

View File

@ -33,6 +33,7 @@
#include <map> #include <map>
#include <memory> #include <memory>
#include <stack> #include <stack>
#include <type_traits>
#include <utility> #include <utility>
static Token *skipRequires(Token *tok) static Token *skipRequires(Token *tok)

View File

@ -24,7 +24,6 @@
#include "config.h" #include "config.h"
#include "errortypes.h" #include "errortypes.h"
#include "tokenlist.h" #include "tokenlist.h"
#include "utils.h"
#include <iosfwd> #include <iosfwd>
#include <list> #include <list>

View File

@ -23,7 +23,6 @@
#include "config.h" #include "config.h"
#include "token.h" #include "token.h"
#include "utils.h"
#include <iosfwd> #include <iosfwd>
#include <string> #include <string>

View File

@ -154,32 +154,4 @@ CPPCHECKLIB bool matchglob(const std::string& pattern, const std::string& name);
CPPCHECKLIB bool matchglobs(const std::vector<std::string> &patterns, const std::string &name); CPPCHECKLIB bool matchglobs(const std::vector<std::string> &patterns, const std::string &name);
#define UNUSED(x) (void)(x)
// Use the nonneg macro when you want to assert that a variable/argument is not negative
#ifdef __CPPCHECK__
#define nonneg __cppcheck_low__(0)
#elif defined(NONNEG)
// Enable non-negative values checking
// TODO : investigate using annotations/contracts for stronger value checking
#define nonneg unsigned
#else
// Disable non-negative values checking
#define nonneg
#endif
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
#define ASAN 1
#endif
#endif
#ifndef ASAN
#ifdef __SANITIZE_ADDRESS__
#define ASAN 1
#else
#define ASAN 0
#endif
#endif
#endif #endif

View File

@ -23,7 +23,6 @@
#include "config.h" #include "config.h"
#include "mathlib.h" #include "mathlib.h"
#include "utils.h"
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>