<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/137705>137705</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
__attribute__((nonstring)) and -Wunterminated-string-initialization
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
frobtech
</td>
</tr>
</table>
<pre>
GCC has `-Wunterminated-string-initialization` and `__attribute__((nonstring))` to counteract it.
The warning is included in `-Wextra`.
It warns for e.g. `char foo[3] = "foo";` because the string will not have a `'\0'` terminator.
It doesn't warn for `__attribute__((nonstring)) char foo[3] = "foo";`.
This would be a useful feature to add to Clang.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMks2K4zoQhZ-mvBExsmzZycKL7oRc7r5hlkE_ZVuDIjVSqXtmnn6QE5htQFAgTlV9pzgqZ7cGxBnkO8hLowptMc1LiprQbI2O9vf83_nMNpUZjPzwowTCdHdBEdpDpuTCenDBkVPe_VHkYoCRMxVsld9uiig5XQhvNxBHEMcQw6MLxKm-kTOKzMR9rjLEHLXA3z42ZN8qBRdW5jJzwfhi0TIXHhj4i5KCkVct8Lf_aVdntsTEsF3bqjKbSmyJEeR7D_LCoL8wEKL-CAH9e92t0aiSkdGG7MHFvp33LERim_pCpuokEBPI814q7_MAMbWP1TZiDiCmB8TO8JJ59gLh0-DH5jL7jsVbpitUybgUzxZUVBLWEyprazl7Fdba1Ni5t6f-pBqcu2mQx6kbBtFs8zjpbuF6MEZyZU-mN0JqbU5ywWXqOtW4WXAh-SCOgneTEC0fUZre8lHqrpf9AgPHu3K-9f7r3sa0Ni7ngnPXTxOXjVcafd4jJYSpPNWNvDRprg0HXdYMA_cuU_43ghx5nF84Ws3WKzlsSvLzRvSZoX8DcQVxXR1tRbcm3kFc6-ZnOXym-BMNgbjuTjKI69PM1yz-BgAA__-ixP-5">