Skip to content

Add regression tests for macro expansion #744

Closed

Description

@danmar

Part of replacing the macro expansion (see #742).

Before the macro expansion is refactored and replaced, its current behaviour needs better test coverage so that changes in later PRs can be checked against it. This PR only adds and adjusts tests. There are no changes in simplecpp.cpp.

Tests added

  • Examples 3, 4, 5 and 7 from C11 6.10.3.5.
  • The C23 __VA_OPT__ examples.
  • Invalid ## pastes.
  • Token::macro, the locations of expanded tokens, and the macro usage, which cppcheck uses. A new helper expandedTokens() writes each output token with its macro name and location, and the tokenMacro tests use it.

Activity

  1. added a commit that references this issue on Nov 9, 2026
    c137175
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions