Skip to content

Commit 074c1e1

Browse files
dmcppcheckclaude
andcommitted
Fix CI after simplecpp 1.10.0 update
- simplecpp: pass DUI when loading included files so the C/C++ standard is known and simplecppPortabilityNoEofNewline is not reported for C++ headers - add trailing newlines to C test inputs that now trigger simplecppPortabilityNoEofNewline - misra-test.c: simplecpp no longer evaluates #elif after a taken branch, restructure the 20.8 test so both conditions are evaluated - regenerate Makefile with dmake Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e8d9957 commit 074c1e1

8 files changed

Lines changed: 14 additions & 13 deletions

File tree

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ cli/threadexecutor.o: cli/threadexecutor.cpp cli/executor.h cli/threadexecutor.h
736736
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
737737
$(CXX) ${INCLUDE_FOR_TEST} ${CFLAGS_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/fixture.cpp
738738

739-
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
739+
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
740740
$(CXX) ${INCLUDE_FOR_TEST} ${CFLAGS_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/helpers.cpp
741741

742742
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

‎addons/test/misra/misra-ctu-1-test.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ void misra_8_7_external(void) {}
5252

5353
// #12362
5454
void misra_8_7_compliant( void ){}
55-
static void misra_8_7_call(void) { misra_8_7_compliant(); }
55+
static void misra_8_7_call(void) { misra_8_7_compliant(); }

‎addons/test/misra/misra-ctu-2-test.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ static void misra_8_7_caller(void) {
5656

5757
// #12362
5858
typedef void(*misra_8_7_func_ptr)( void );
59-
static const misra_8_7_func_ptr ptrs[] = { misra_8_7_compliant, NULL };
59+
static const misra_8_7_func_ptr ptrs[] = { misra_8_7_compliant, NULL };

‎addons/test/misra/misra-ctu-test.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ void misra_8_7_external(void);
2121
// #12362
2222
extern void misra_8_7_compliant( void );
2323

24-
#define MISRA_2_5_OK_3 This
24+
#define MISRA_2_5_OK_3 This

‎addons/test/misra/misra-test.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1943,8 +1943,9 @@ struct { int a; } struct_20_7_s; // 8.4
19431943
#define MUL(a ,b ) ( a * b ) // 20.7
19441944

19451945
#if __LINE__ // 20.8
1946+
#endif
1947+
#if 2-2
19461948
#elif 2+5 // 20.8
1947-
#elif 2-2
19481949
#endif
19491950

19501951
#if A // 20.9

‎externals/simplecpp/simplecpp.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3926,7 +3926,7 @@ std::pair<simplecpp::FileData *, bool> simplecpp::FileDataCache::tryload(FileDat
39263926
return {id_it->second, false};
39273927
}
39283928

3929-
auto *const data = new FileData {path, TokenList(path, filenames, {}, outputList)};
3929+
auto *const data = new FileData {path, TokenList(path, filenames, dui, outputList)};
39303930

39313931
if (dui.removeComments)
39323932
data->tokens.removeComments();

‎samples/multiCondition/good.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ int main()
88
{
99
f(true);
1010
return 0;
11-
}
11+
}

‎test/cli/other_test.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def test_progress(tmpdir):
157157
int main(int argc)
158158
{
159159
}
160-
""")
160+
""")
161161

162162
args = ['--report-progress=0', '--enable=all', '--inconclusive', '-j1', test_file]
163163

@@ -248,7 +248,7 @@ def test_progress_j(tmpdir):
248248
int main(int argc)
249249
{
250250
}
251-
""")
251+
""")
252252

253253
args = ['--report-progress=0', '--enable=all', '--inconclusive', '-j2', '--disable=unusedFunction', test_file]
254254

@@ -2764,7 +2764,7 @@ def __test_addon_suppr(tmp_path, extra_args):
27642764
// cppcheck-suppress misra-c2012-2.3
27652765
typedef int MISRA_5_6_VIOLATION;
27662766
typedef int MISRA_5_6_VIOLATION_1;
2767-
""")
2767+
""")
27682768

27692769
args = [
27702770
'-q',
@@ -2818,7 +2818,7 @@ def test_ctu_path_builddir(tmp_path): # #11883
28182818
int *p = 0;
28192819
f(p);
28202820
}
2821-
""")
2821+
""")
28222822

28232823
args = [
28242824
'-q',
@@ -4522,7 +4522,7 @@ def run_and_assert_cppcheck(stdout_exp):
45224522

45234523
# modified file
45244524
with open(test_file, 'a') as f:
4525-
f.write('\n#define DEF')
4525+
f.write('\n#define DEF\n')
45264526

45274527
run_and_assert_cppcheck([
45284528
"discarding cached result from '{}' for '{}' - hash mismatch".format(test_a1_file_s, test_file_s)
@@ -4930,7 +4930,7 @@ def test_ipc_inline_suppressions(tmp_path):
49304930
def test_ipc_hash_suppressions(tmp_path):
49314931
test_file = tmp_path / 'test.c'
49324932
with open(test_file, "w") as f:
4933-
f.write('void f() { int x = 1; }')
4933+
f.write('void f() { int x = 1; }\n')
49344934

49354935
_, _, stderr = cppcheck(['--enable=style', '--xml-version=3', str(test_file)])
49364936
error_hash = ElementTree.fromstring(stderr).find('.//error').get('hash')

0 commit comments

Comments
 (0)