Repository navigation
Conversation
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
dmcppcheck
left a comment
There was a problem hiding this comment.
AI review
I found no problems. When combineOperators() merges tokens, the PR now copies the whitespaceahead flag from the last merged token to the combined one. That covers every merge in the function: ..., float literals, exponents, compound assignments, &&, ||, ::, ->, <<, >>, <<=, >>=, ++ and --. With the PR, #x keeps the space after these operators, as gcc and clang do. The previous TODO_ASSERT_EQUALS in macro_c11_example4 is now a real assertion and passes. The change adds no cost to preprocessing and does not touch the API.
Testing
Build and test suites
make -j8 testrunner simplecpp CXXOPTS=-Werrorinpr/built with no warnings../testrunner: 0 failed.python3 run-tests.py: 176 tests, 21 skipped, 15 todos, 0 failed.python3 -m pytest integration_test.py: 128 passed../selfcheck.sh: exit code 0.
My own tests
I wrote stringification tests in /work/scratch and ran them through pr/simplecpp, base/simplecpp, gcc -E -P and clang -E -P. They covered:
s(a == b),s(a ==b),s(a<<= 2)ands(a >>== b)s(1.5 f),s(.5 x),s(1.e x),s(1e+5 x)ands(0x1p+1 x)s(x ... y),s(f(a ... )),s(a .. .b)ands(a+++ b)s(a:: b),s(a&& b)ands(a-> b)- Operators followed by a comment, by a backslash-newline or by a newline inside the macro arguments
- Arguments built by
##, nested macro expansion (str(P(a ->) b)) and#__VA_ARGS__
Results
- The PR's output matches gcc and clang in all of these cases.
- Base lost the space in many of them, for example
"a ==b","1.5f","x ...y","a ->b"and"a ==b , c ->d". - One mismatch is still there, and base gives the same result, so the PR did not cause it:
s(1e+ 5)gives"1e+5", while gcc and clang give"1e+ 5".
Automated review of 8f6fc00 by Claude. The pull request was built and tested locally.
|
This fixed #754 |
No description provided.