Issue 120875
Summary Clang (C23): Attributes with unknown "attribute-prefix" should not raise "-Wunknown-attributes"
Labels clang
Assignees
Reporter namandixit
    With `--std=c23`, when using attributes with an arbitrary `attribute-prefix`, Clang raises the warning `-Wunknown-attributes` as shown below.

```sh
$ cat test.c
[[cthrough::hello(bye((no)) go(away((please)))), cthrough::alvida(la la la la)]]
int main (void)
{
	return 3;
}
$
$
$ clang --std=c23 test.c -o exe
test.c:1:3: warning: unknown attribute 'hello' ignored [-Wunknown-attributes]
    1 | [[cthrough::hello(bye((no)) go(away((please)))), cthrough::alvida(la la la la)]]
      | ^~~~~~~~~~~~~~~
test.c:1:50: warning: unknown attribute 'alvida' ignored [-Wunknown-attributes]
    1 | [[cthrough::hello(bye((no)) go(away((please)))), cthrough::alvida(la la la la)]]
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

The whole point of `attribute-prefix`s is to be able to use attributes for multiple compilers without a `#ifdef`-hell. Thus, there is no reason for this warning to be raised. And if a warning has to be raised, it should be a different one (perhaps `-Wunknown-attribute-prefix`) such that it can selectively be disabled (since `-Wunknown-attributes` is useful in case of misspelled attributes in general).
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to