Skip to content

Do not record a usage for a function-like macro name without ( #773

Closed

Description

@danmar

Macro::expand() adds the use location to usageList before it checks whether a function-like macro is followed by (. So with #define F(x) x, the F in int F = 1; shows up in the macro usage list even though nothing is expanded there.

Came up in cppcheck-opensource/cppcheck#9018, where cppcheck uses the usage list to apply cppcheck-suppress-macro and that phantom usage suppressed a real zerodiv. That PR filters it on the cppcheck side for now.

Activity

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