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-token-stream-expander
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 4 commits
  • 4 files changed
  • 2 contributors

Commits on Nov 11, 2026

  1. Add tests for macro expansion

    Rescanning and recursion, __VA_OPT__, and a # from a macro at the start of
    a line. The results are the same as gcc gives. Where the current macro
    expansion gives another result, it is a TODO_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
    03edd42 View commit details
    Browse the repository at this point in the history
  2. Add TokenStreamExpander, a macro expansion with a token stream

    The result of an expansion is pushed back onto the input followed by an
    end-of-expansion marker, and is scanned again. A macro is disabled from
    the moment its result is pushed until the marker has been read, also
    while the arguments of a call are collected. A name that is read while
    its macro is disabled is painted and never expanded.
    
    It is not used yet.
    
    Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
    dmcppcheck and claude committed Nov 11, 2026
    Configuration menu
    Copy the full SHA
    7a7889b View commit details
    Browse the repository at this point in the history
  3. Use TokenStreamExpander for macro expansion

    Fixes the R/DEFER/EXPAND recursion idiom, __VA_OPT__ after expansion, #
    and ## with __VA_OPT__, pasting that is rescanned, and a function-like
    macro name at the end of the file (it is not a call). A # that comes from
    a macro at the start of a line gets a space before it, as gcc and clang
    do, so the output is not read as a directive. The tokens of an expansion
    now have the location of the macro call.
    
    The tests that had a TODO for the old expansion are updated.
    
    Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
    dmcppcheck and claude committed Nov 11, 2026
    Configuration menu
    Copy the full SHA
    3d82c3e View commit details
    Browse the repository at this point in the history
  4. Remove the old macro expansion

    Macro::expand and the functions only it used, and Token::mExpandedFrom.
    Macro keeps parsing of the definition, the argument handling and the
    checks that TokenStreamExpander uses.
    
    Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
    dmcppcheck and claude committed Nov 11, 2026
    Configuration menu
    Copy the full SHA
    e9fd2ad View commit details
    Browse the repository at this point in the history
Loading