Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
cmake_minimum_required(VERSION 3.22)
project(Cppcheck VERSION 2.22.99 LANGUAGES CXX)

# CMake 4.5 added the opt-in CMD_STRICT diagnostics (e.g. non-target-directive).
# They are ignored by default, but -Werror=dev promotes them to errors.
if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.5)
cmake_diagnostic(SET CMD_STRICT IGNORE RECURSE)
endif()

include(cmake/options.cmake)

include(cmake/cxx11.cmake)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ cli/threadexecutor.o: cli/threadexecutor.cpp cli/executor.h cli/threadexecutor.h
test/fixture.o: test/fixture.cpp externals/tinyxml2/tinyxml2.h lib/check.h lib/checkers.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/refthunk.h lib/settings.h lib/standards.h lib/timer.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/xml.h test/fixture.h test/helpers.h test/options.h test/redirect.h
$(CXX) ${INCLUDE_FOR_TEST} ${CFLAGS_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/fixture.cpp

test/helpers.o: test/helpers.cpp cli/filelister.h externals/simplecpp/simplecpp.h externals/tinyxml2/tinyxml2.h lib/checkers.h lib/config.h lib/filesettings.h lib/library.h lib/mathlib.h lib/path.h lib/pathmatch.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/xml.h test/helpers.h
test/helpers.o: test/helpers.cpp cli/filelister.h externals/simplecpp/simplecpp.h externals/tinyxml2/tinyxml2.h lib/checkers.h lib/config.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/path.h lib/pathmatch.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/xml.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} ${CFLAGS_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/helpers.cpp

test/main.o: test/main.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkers.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/refthunk.h lib/settings.h lib/standards.h lib/utils.h test/fixture.h test/options.h
Expand Down
4 changes: 3 additions & 1 deletion addons/cppcheckdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class MacroUsage:
useline
usecolumn
isKnownValue
arg Argument of an integer constant macro call (INTn_C / UINTn_C), empty for other macros
"""
#preprocessor.cpp/Preprocessor::dump

Expand All @@ -168,9 +169,10 @@ def __init__(self, element):
self.useline = element.get('useline')
self.usecolumn = element.get('usecolumn')
self.isKnownValue = element.get('is-known-value', 'false') == 'true'
self.arg = element.get('arg', '')

def __repr__(self):
attrs = ["name", "file", "linenr", "column", "usefile", "useline", "usecolumn", "isKnownValue"]
attrs = ["name", "file", "linenr", "column", "usefile", "useline", "usecolumn", "isKnownValue", "arg"]
return "{}({})".format(
"MacroUsage",
", ".join(("{}={}".format(a, repr(getattr(self, a))) for a in attrs))
Expand Down
2 changes: 1 addition & 1 deletion addons/test/misra/misra-ctu-1-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ void misra_8_7_external(void) {}

// #12362
void misra_8_7_compliant( void ){}
static void misra_8_7_call(void) { misra_8_7_compliant(); }
static void misra_8_7_call(void) { misra_8_7_compliant(); }
2 changes: 1 addition & 1 deletion addons/test/misra/misra-ctu-2-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ static void misra_8_7_caller(void) {

// #12362
typedef void(*misra_8_7_func_ptr)( void );
static const misra_8_7_func_ptr ptrs[] = { misra_8_7_compliant, NULL };
static const misra_8_7_func_ptr ptrs[] = { misra_8_7_compliant, NULL };
2 changes: 1 addition & 1 deletion addons/test/misra/misra-ctu-test.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ void misra_8_7_external(void);
// #12362
extern void misra_8_7_compliant( void );

#define MISRA_2_5_OK_3 This
#define MISRA_2_5_OK_3 This
3 changes: 2 additions & 1 deletion addons/test/misra/misra-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1943,8 +1943,9 @@ struct { int a; } struct_20_7_s; // 8.4
#define MUL(a ,b ) ( a * b ) // 20.7

#if __LINE__ // 20.8
#endif
#if 2-2
#elif 2+5 // 20.8
#elif 2-2
#endif

#if A // 20.9
Expand Down
Loading
Loading