On Thu, Feb 13, 2025 at 02:10:25PM +0100, Jakub Jelinek wrote:
> Kees, are you submitting this under assignment to FSF (maybe the Google one
> if it has one) or DCO?  See https://gcc.gnu.org/contribute.html#legal
> for details.  If DCO, can you add your Signed-off-by: tag for it?
> 
> So far lightly tested, ok for trunk if it passes bootstrap/regtest?

Bootstrapped/regtested on x86_64-linux and i686-linux successfully.

> 2025-02-13  Kees Cook  <k...@kernel.org>
>           Jakub Jelinek  <ja...@redhat.com>
> 
>       PR c/117178
> gcc/
>       * doc/invoke.texi (Wunterminated-string-initialization): Document
>       the new interaction between this warning and -Wc++-compat and that
>       initialization of decls with nonstring attribute aren't warned about.
> gcc/c-family/
>       * c.opt (Wunterminated-string-initialization): Don't depend on
>       -Wc++-compat.
> 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
>       warn_cxx_compat with OPT_Wc___compat, wording which mentions "for C++"
>       and provides details on lengths, otherwise for
>       warn_unterminated_string_initialization adjust the warning, provide
>       details on lengths and don't warn if get_attr_nonstring_decl (decl).
>       (build_c_cast, store_init_value, output_init_element): Adjust
>       digest_init callers.
> gcc/testsuite/
>       * gcc.dg/Wunterminated-string-initialization.c: Add additional test
>       coverage.
>       * gcc.dg/Wcxx-compat-14.c: Check in dg-warning for "for C++" part of
>       the diagnostics.
>       * gcc.dg/Wcxx-compat-23.c: New test.
>       * gcc.dg/Wcxx-compat-24.c: New test.

        Jakub

Reply via email to