Repository navigation
Fix #15239 (Add tests for the simplecpp portability reports and the macro-usage arg) - #9057
Merged
Merged
Conversation
… dump The simplecpp update reports PORTABILITY_BACKSLASH and PORTABILITY_NO_EOF_NEWLINE as portability messages and writes the argument of an integer constant macro call to <macro-usage>, with no test for either. portabilityReports checks both ids are reported with portability enabled and nothing without it. dumpMacroUsageArg checks arg= is written for INT64_C(5) and left out for other macros. getcode() now calls reportSimplecppPortability() after removeComments(), as CppCheck::checkInternal does, so the main file's portability messages reach the test logger. dumpMacroUsageArg checks each <macro> entry without relying on their order: simplecpp emits macro usages from an unordered_map, so libc++ and libstdc++ list them in different orders.
JayToltTech
force-pushed
the
test-15239-main
branch
from
November 22, 2026 00:35
c6e7f04 to
69b8996
Compare
dmcppcheck
reviewed
Nov 22, 2026
dmcppcheck
left a comment
Contributor
There was a problem hiding this comment.
AI review
I found no problems. The PR only touches tests. Both new tests pass, and so does the full testrunner. The getcode() change is needed: without the added reportSimplecppPortability() call, portabilityReports fails. With it, every other TestPreprocessor test still passes.
Testing
- I built
testrunnerin/work/prwithmake -j8, and it built without errors. ./testrunner TestPreprocessorran 185 tests with 0 failures. BothTestPreprocessor::portabilityReportsandTestPreprocessor::dumpMacroUsageArgpass.- The full
./testrunnerexits with 0 and reportsTests failed: 0. - I also checked that the
getcode()change is needed. I removedpreprocessor.reportSimplecppPortability(outputList);fromgetcode()and rebuilt.portabilityReportsthen failed at test/testpreprocessor.cpp:3334, because both expected portability messages were missing (actual output was empty). After that I restored the line. So the test really exercises the main-file reporting path, and the helper change does not alter any other preprocessor test. - I wrote no extra scratch inputs, because the PR changes no behaviour in lib/ or cli/.
Automated review of 69b8996 by Claude. The pull request was built and tested locally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://trac.cppcheck.net/ticket/15239
Tests for two things #9048 added that have no unit test yet.
portabilityReports:simplecppPortabilityBackslashandsimplecppPortabilityNoEofNewlineare reported from the main file with portability enabled, and nothing is reported without it.dumpMacroUsageArg: the dump's<macro-usage>writesarg=for an integer constant macro call (INT64_C(5)) and leaves it out for other macros.The
getcode()helper now callsreportSimplecppPortability()afterremoveComments(), the same pointCppCheck::checkInternalcalls it, so the main file's portability messages reach the test logger.These were first proposed against the #9048 branch (cppchecksolutions#4), which merged without them, so this brings them to main.
testrunnerpasses (TestPreprocessor, TestSuppressions, TestCppcheck, and the full run).runformatwith uncrustify 0.80.1 makes no changes.