https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178

--- Comment #29 from Alejandro Colomar <alx at kernel dot org> ---
Hi Kees,

(In reply to GCC Commits from comment #28)
> The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:
> 
> https://gcc.gnu.org/g:622968990beee7499e951590258363545b4a3b57

I guess I should have reviewed the commit message when I was in time.  Anyway,
here are a few comments for next time.  :-)

> 
> commit r15-7900-g622968990beee7499e951590258363545b4a3b57
> Author: Jakub Jelinek <ja...@redhat.com>
> Date:   Fri Mar 7 23:59:34 2025 +0100
> 
>     c: do not warn about truncating NUL char when initializing nonstring
> arrays [PR117178]
>     
>     When initializing a nonstring char array when compiled with
>     -Wunterminated-string-initialization the warning trips even when
>     truncating the trailing NUL character from the string constant.  Only
>     warn about this when running under -Wc++-compat since under C++ we should
>     not initialize nonstrings from C strings.

The paragraph above is a bit unclear.  If I'm understanding it correctly, I
think the first sentence refers to the behavior before this patch?  If so,
using past might have been clearer.

>     gcc/c/
>             * c-typeck.cc (digest_init): Add DECL argument.  Adjust wording
> of
>             pedwarn_init for too long strings and provide details on the
> lengths,
>             for string literals where just the trailing NULL doesn't fit
> warn for

NULL is the null pointer constant.  You meant NUL, which is the ASCII name for
the null byte.


Cheers,
Alex

Reply via email to