Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cppcheck-opensource/simplecpp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: cppcheck-opensource/simplecpp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: pr-macro-refactor
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 6 commits
  • 4 files changed
  • 2 contributors

Commits on Nov 11, 2026

  1. Rename mExpandedFrom to mHideSet and hold macro names instead of Macro*

    The names are what Prosser's algorithm uses, and they can not dangle
    after #undef. This also removes the dependency on class Macro from
    Token and simplecpp.h. No change in behaviour.
    
    Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
    dmcppcheck and claude committed Nov 11, 2026
    Configuration menu
    Copy the full SHA
    fdf4313 View commit details
    Browse the repository at this point in the history
  2. Add HideSetExpander behind DUI::hideSetExpansion

    Macro expansion with hide sets (Prosser's algorithm), selected with
    DUI::hideSetExpansion and a command line option in main.cpp. It handles
    function-like and object-like macros, #, ##, __VA_OPT__ and defined in a
    replacement list. The old expansion is still the default.
    
    test.cpp runs the test suite twice, once with each expander, so the new
    one is tested from the start. Cases the new expander does not handle yet
    are skipped with HIDESET_EXPANSION_TODO, and cases where the old
    expansion is wrong are marked TODO_OLD_EXPANSION_ASSERT_EQUALS.
    
    Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
    dmcppcheck and claude committed Nov 11, 2026
    Configuration menu
    Copy the full SHA
    58c9a43 View commit details
    Browse the repository at this point in the history
  3. HideSetExpander: remove the comma before an empty __VA_ARGS__

    Same as the old expansion (cppcheck trac #9754).
    
    Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
    dmcppcheck and claude committed Nov 11, 2026
    Configuration menu
    Copy the full SHA
    195279c View commit details
    Browse the repository at this point in the history
  4. HideSetExpander: an unterminated macro call is not expanded

    The tokens after the macro name are scanned again, like in the old
    expansion.
    
    Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
    dmcppcheck and claude committed Nov 11, 2026
    Configuration menu
    Copy the full SHA
    adf2521 View commit details
    Browse the repository at this point in the history
  5. HideSetExpander: Token::macro and location rules

    Tokens of an object-like macro get its name even if they are produced by
    macros that are expanded inside it. A call that is completed with tokens
    after the expansion gets the location of the first source token in the
    call, and the macro usage is recorded there. The results of # and ## have
    no macro name.
    
    Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
    dmcppcheck and claude committed Nov 11, 2026
    Configuration menu
    Copy the full SHA
    df5adae View commit details
    Browse the repository at this point in the history
  6. Use the macro expansion with hide sets by default

    DUI::hideSetExpansion is replaced by DUI::oldExpansion (command line
    option -old-expansion) to go back to the old expansion. It is kept for
    one release and then removed. The tests are run once with the new
    expansion, and TODO_OLD_EXPANSION_ASSERT_EQUALS is now ASSERT_EQUALS.
    
    Behaviour change: the cases that were marked TODO_OLD_EXPANSION in
    test.cpp were bugs of the old expansion (for instance wrong output for
    a macro call with the wrong number of arguments, and for # in a
    replacement list), they are fixed by the new expansion.
    
    Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
    dmcppcheck and claude committed Nov 11, 2026
    Configuration menu
    Copy the full SHA
    0438ac2 View commit details
    Browse the repository at this point in the history
Loading