<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/81767>81767</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Diagnose GNU-style attribute differences with GCC
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            enhancement,
            quality-of-implementation,
            clang:diagnostics,
            extension:gnu
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          AaronBallman
      </td>
    </tr>
</table>

<pre>
    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.)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMlM-OozgQxp_GXEqJiAkhHDjkz2Z2L3uZXc2xVdgFeGRsxjahs0-_Mkkn6Wm11JKViML86nPVV0bvVWuIKpbvWX5McAydddUOnTV71LpHk9RWXqpvhwNM6CF0BMqooFCD6gdNPZlADmwzv2Kb9OUFQ3CqHgO9vDC-nVcZ1yYFeg1kvLKG8QNMnRIdHDSaFjr0IOygSC7hTzvRmVzcYs_kZvCF0PkYeWyX6kyuJQmNsz1EgcpAINf7qGbqyBFMBCgEDWGG3IWBv5iAIiiBWl-A8e1EjBdnAtTePsjPQD-QUI0ST5R7ATAoa2Z59RhTKQ_K-5FA-cd3wc4i5tSvkfihWJuU8XIJfwWY7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