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

    <tr>
        <th>Summary</th>
        <td>
            [clang] document default for `__GNUC__` macros
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          h-vetinari
      </td>
    </tr>
</table>

<pre>
    While the [documentation](https://clang.llvm.org/docs/UsersManual.html#cmdoption-fgnuc-version) notes how to override GNU compatibility macros using `-fgnuc-version=`, it doesn't note that it's set by default (it is), nor what value it is set to.

It takes a far bit of [digging](https://github.com/llvm/llvm-project/issues/42162#issuecomment-2241520557) in the code to actually figure out that it's still at 
```
__GNUC__=4
__GNUC_MINOR__=2
__GNUC_PATCHLEVEL__=1
```
which is ancient (cf. #42162). The consequence of this is that benign-looking code based on these macros will implicitly fall back to workarounds that shouldn't actually be necessary, and end up pessimizing clang-compiled code. Example: https://github.com/scipy/scipy/issues/20479
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVE1v4zYQ_TX0ZWBDHn1ZBx2ycbxdYDctik17DChyLE1Dka5IOnV_fUHG6zbFoocChgkNNU_z3rwZ6T2PlqgX9QdR71cyhskt_bQ-U2ArF14NTl_6Xyc2BGEiEPUH7VScyQYZ2FlR7wXuphBOXpR3Ag8CD8pIO26MOc8bt4wCD9opL_Dw5GnxX6SN0mymMBuBpZq1OyWc9XG0Ua3PtPiEih1YF8jD5F4hOHBnWhbWBB8fn0C5-SQDD2w4XGCWanEeomc7gmiKfyGVe9EUAu-BA2hH3gpsQwaHMMkAHAS2HjwFGC6g6SijCSBwxwHYC-xSrnULvKa3z9JEgnyVU4LbiGIviru3_08BgnwhDxKOcoGBA7hj1ozHke34PbVGDlMcNsrNAg9JtOuxPi3uN1JB4IG9j5QUrHDboMAyB5SbUxvWiNW2xqKu2yQb29wn5TQl4aQKURpzgSOPcSFwMbznHdgYkAGuNJri-suPz88fH5_un59Fua_eRb58evzx5xzHd_Gf7r7e__D54ZeHz_ly-13U14nVlBSUVjHZrLY6bkBgeSXYbeBrJmE9_R7JKko6hol9Ssv1D2R5tGvj3EtqfOY7SE8aXFbA0zdnvCaGPJ8MKw5JCWkMDFK9JH1e3fIiFxetvuL6yUWj31xyE28gsKTIe7lckh-k1UBWQzzBibznmf_MRSTjr5M92ZDONW3g4Q85nwyJ8g7-o_Fe8enyj_PWciyqtlvpvtRd2ckV9dsWt3XVtU2zmnosimHXHUvdNZ1qu-K4xUpjN-CWhkG39Yp7LLAqWtwWu21T1Jtat7KiXdsoSUNdalEVNEs2t3ld5U_3XbcrqpWRAxmftwNipicQ06JY-uzRIY5eVIVhH_zfCIGDySvlLaPew7edcRuwo1vSsN4M1hTXdq3iYvr_PyFvZZ97_CsAAP__NA2Siw">