<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58478>58478</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
-Wimplicit-function-declaration emitted with atomic builtins
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
thesamesam
</td>
</tr>
</table>
<pre>
Hello,
It looks like the following test program emits a -Wimplicit-function-declaration warning (which becomes an error with Clang 16):
```
#include <stdint.h>
int main() {
char i;
__atomic_exchange_1(&i, 1, 0);
return 1;
}
```
```
$ gcc /tmp/foo.c -o /tmp/foo && /tmp/foo
$
$ clang /tmp/foo.c -o /tmp/foo
/tmp/foo.c:4:5: error: call to undeclared function '__atomic_exchange_1'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
__atomic_exchange_1(&i, 1, 0);
^
1 error generated.
$
```
This breaks building systemd with newer Clang: https://github.com/systemd/systemd/issues/25057 (originally reported at https://bugs.gentoo.org/877259).
I don't see what could provide the prototype for builtins.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVE1v2zAM_TXyhYhhO_48-LCmK9bTDhuwYyDLrK1VlgJJbpZ_P8pO1qQo2sMCW6EokaLee3Rn-lP7DZUyLNux5J4lX9bx0YMy5tmBks8IfkR4MrTrKPUAHp2HgzWD5RPgJL0DDptfcjooKaTfPM1aeGn0pkehuOXBhiO3OgSzrD6OUozQoTATUqgGtNZYOEo_wk5x2pSWLGvY9lwLK5Pzs06zrdRCzT0C2-6c76X28ci2X9dlmsHEpaaDKAmw6m71A_3EyC1Itr1y7ffcm0mKPf6hVT3gPl0iS0mIQBqGZCnmKsain62mxYuTVffvl_p-_TkMQhASD3460PhkTCxgY248NCEQyhvfv_jXRGLB6-NUl93XewjcnN6C3hX-YAiuFHgDs16Zwx4uXFLC6l2oKgIBHn98h13TEJc9KO7RQm9AGw9uPhyM9XDRxmu-K204YMXdJ_phxf3_ccaKsz7Ss9wG1Ei5sY_fwvoehz9H6aCzyKklulmqPmjZnZzHqV-Vq_FI9170G7AcvT-4IOHsgZ6BdsxdTIqnyTnsxpLOzejIyIqkqEKXGCsHqYmRE-ktgEhscP8mbzcPLqabeOLU2IE8dVVlRUO3j2_amQihjqiIEUQ4jpRImFn1oY1fZL92ONne-NMh9LpdbumldnGEbVqWZZZkTZ1Hfbvtm23DIy-9wvaztg-fh1D5AtHK2r_M0WxV-wFOSr1c_jZU228U_hqpos6rOhrbrBNZk3d1l5aYN0Vai6wumqRM8oznaSMixTtUriWRsSwjmmBJQTaJKpItXSxLk7RJ66TJ8zgvnxrOMa9531VlkbA8QfqeqDjUEUCObLuUFLCnRSWdd6-L3Dk5aMTlOMrPZz8a2xK-jk_hjZbT26X6v-9pscE">