llvm / llvm/llvm-project

defined(__COUNTER__) results in an unexpected extension diagnostic

Open
#196,474 3 comments 0 reactions 0 assignees View on GitHub
c2y clang:diagnostics
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

```
/home/rpnx/quxlang/dev-workspace/sources/benchmark/include/benchmark/benchmark.h:1483:30: error: '__COUNTER__' is a C2y extension [-Werror,-Wc2y-extensions]
1483 | #if defined(__COUNTER__) && (__COUNTER__ + 1 == __COUNTER__ + 0)
```

Clang should not error when `__COUNTER__` is disabled by compiler flags, the defined clause should return false and then clang should continue on without an error.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.