Skip to content

add -Wmacro-redefined-duplicate #132609

Open
@kasperk81

Description

@kasperk81

C language allows macro redefinition as long as the values are the same. when values are different clang issues -Wmacro-redefined.

a new diagnostic -Wmarco-redefined-duplicate would help with code cleanup. clang already has that information (it clearly "skips" -Wmacro-redefined when values are the same), so it should be able to expose it in pedantic mode.

there is an indirect way to detect it using -Wunused-macros:
https://godbolt.org/z/dxG8K1cPb
but it only flags the first occurrence of same-value-duplicate as unused and doesn't show the other occurrence(s).

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing feature

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions