<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/132609>132609</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
add `-Wmacro-redefined-duplicate`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kasperk81
</td>
</tr>
</table>
<pre>
C language allows macro redefinition as long as the values are the same. when values are different clang issues `-Wmacro-redefined`.
a new diagnostic `-Wmarco-redefined-duplicate` would help with code cleanup. clang already has that information (it clearly "skips" `-Wmacro-redefined` when values are the same), so it should be able to expose it in pedantic mode.
there is an indirect way to detect it using `-Wunused-macros`:
https://godbolt.org/z/dxG8K1cPb
but it only flags the first occurrence of same-value-duplicate as unused and doesn't show the _other_ occurrence(s).
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0k09z8ygMxj8NvmjiwXLsJAcfut3JHvaytz12ZJBttgQ8gJtmP_07kHTa998JGKFHzw8kitHMjnkQ3R-i-7OiLS0-DK8UVw6vx6Yavb4Nz2DJzRvNDGStv0a4kAoeAmuejDPJeAcUwXo35zUtDG9kN45Agcsx0oVruC7svka0mSYO7BKoXAFMjDkkern7t5TYPUqwFr2shXwS8onA8RW0odn5mIz6uB7Ul-s7va3WKEoseglXv1kNC9sVriYtoLxmUJbJbWv9qE02MOkbLAWAEhg3-XChAifwaFLJCPYGAjG-mjUKxN95_Qn14xEEngQ-Q_RgEsSlGBsZaLQMyQO_rz5yjhkHK2tymfDiNT_o08KBwUQgB8ZpE1gluNItJ2tO-WQSbNG4-e5tc1tkvSsWo-ilaLPMktIa8xbPAs-z16O3qfZhFnj-X-BZv_91_LtR_4xCPo1b0fTO3mCyNN8_eDIhJvBKbSGwUwx-KoC7Av35_rkh7h6AnAbtOTqBhwJ_LUovPkO9fNESeIwCT3Wlh1af2hNVPDSHPR5a7Jq-WoZ-VHqUBzohd6ym9tTQtFfUttw1bSvbygwosZMttg1i0_W16hqpSSO27V6N8ij2ki9kbG3t2yWDV6X5hqbFXp4qSyPbWMYCMfdbiQrEPCVhyEm7cZuj2EtrYoqfMskkywNp_cvW-K4vqy3Y4YefMGnZxlr5i8Bz1nwsuzX4_1glgef7kAg8P6y-DfgtAAD__2vERSk">