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

--- Comment #9 from Alejandro Colomar <alx at kernel dot org> ---
(In reply to Kees Cook from comment #7)
> Could "nonstring" be applied to string literals? (Like the "u" suffix idea,
> but this would be more backward-compatible.) For example, from the example
> in comment #1:
> 
>  { "BOOP", ... }
> 
> becomes:
> 
>  { "BOOT" __attribute__((nonstring)), ... }
> 
> and now it doesn't have a NUL-byte terminator?
> 
> That would allow for trivial adjustment of the initializers, and leave the
> -Wunterminated-string-initialization not having do make exceptions.

I think it's simpler to have -Wc++-compat warn about any uses of
[[gnu::nonstring]] at all, since C++ does not want such thing.  That would
cover all cases of unterminated initializations, so would keep Andrew happy, I
think.  Does it, Andrew?

Reply via email to