-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Open
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/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 featureImproving things as opposed to bug fixing, e.g. new or missing featureextension:gnuquality-of-implementation
Description
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.)
thesamesam
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/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 featureImproving things as opposed to bug fixing, e.g. new or missing featureextension:gnuquality-of-implementation