Issue 81767
Summary Diagnose GNU-style attribute differences with GCC
Labels enhancement, quality-of-implementation, clang:diagnostics, extension:gnu
Assignees
Reporter AaronBallman
    GCC was the initial implementer of the `__attribute__(())` extension, which Clang has copied. However, over the years, Clang has diverged from GCC in terms of where we accept the attribute syntactically (we've also diverged in terms of specific attribute implementations, but this issue is specific to the syntax of `__attribute__`). It would be nice to issue a diagnostic telling users about those divergences, under the `-Wgcc-compat` warning (or a new warning grouped under that one).

e.g., 
```
[[]] __attribute__(()) void func1(); // Both accept
__attribute__(()) [[]] void func2(); // Clang accepts, GCC rejects

struct [[]] __attribute__(()) S1 { // Both accept
};
struct __attribute__(()) [[]] S2 { // Clang accepts, GCC rejects
};
```
https://godbolt.org/z/oq5T55jfE

(We should try to be exhaustive at finding all the places we've diverged, more may exist than what's listed here.)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to