<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/116296>116296</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] -Wunreachable-code does not work on macros
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tiagomacarios
</td>
</tr>
</table>
<pre>
For the code below clang should emit 2 unreachable code warnings, but it only emits one
https://godbolt.org/z/fT9rs5xYn
```c++
#include <type_traits>
[[noreturn]] void crash() noexcept;
#define VerifyElseCrash(b) \
if (!b) [[unlikely]] { \
crash(); \
}
void some_other_funtion();
int f1() {
if (!false) [[unlikely]] {
crash();
}
some_other_funtion(); // dead code
}
int f2() {
VerifyElseCrash(false);
some_other_funtion(); // dead code
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykk99uozoQxp9muBklgjF_mgsumqQ8wdE5OleVwUPw1tiRbdpmn34Fodu01fZmkQUSM9_Mb-T5ZAj6ZJlrKPZQHBM5xcH5Omp5cqPspNcuJK1Tl7pxHuPA2DnF2LJxL9gZaU8YBjcZhTzqiIST9Sy7QbZmTX2R3mp7CkAHbKeIOqKz5rLkB3SWIT1Cen99DzGeA4h7oAaoOTnVOhO3zp-Amp9ATf_Pzofi9X-7isr0ejqg_Xyuf0lo25lJMYI4xMuZH6OXOgYQD7fNlpH31nmOk7dQHKE44rPTCjsvwwB0B7RD6_i143MEsf8gJqG415bxX_a6vzyYwIdV1s46KA7XTERE3eNSLltDc-PJGv3E5rI2hmr_UTM_NyAgPsWhOt4CLeDBjfzo4sD-sZ9s1M7-Ft_mahuxz9YBoVpj75S9NIG_I_2O8o-E39Hh9cZRsVTL3qzCjxUWbvrC_fUG3gb4NPcM9TcQb-uWqFqondjJhOusEllJZZXmyVAX3FFeltzKNC13ohdU9UJ2ectZnxVFm-iaUsqzLMtJUJHm24rvFBfiLhVcEe8U5CmPUputMc_jvPmJDmHiOstK2pWJkS2bsLiVaPEfEM3G9fUs2LTTKUCeGh1ieC8RdTSLxa-K4oib_26MulmMqhwHtC7ii_NP6CyOsvMuJJM39Sdf6jhM7bZzI1AzN1k_m7N3P7iLQM0CHYCalfu5pl8BAAD__219Rxg">