Skip to content

missing parenthesis for function-like macro invocation could have better diagnostic #123038

@zmodem

Description

@zmodem

Consider:

$ cat /tmp/a.c
#define FOO() 42
int x = FOO;

The compiler will error because we forgot to use parens for FOO:

$ clang -c /tmp/a.c
/tmp/a.c:2:9: error: use of undeclared identifier 'FOO'
    2 | int x = FOO;
      |         ^
1 error generated.

It would be nice if the compiler diagnostic included a note pointing out that FOO does exist, but as a function-like macro it requires parenthesis.

Metadata

Metadata

Assignees

Labels

clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzergood first issuehttps://github.com/llvm/llvm-project/contribute

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions