Re: [whish] -Wunterminated-string-initialization: new warning

2022-11-14 Thread Alejandro Colomar via Gcc
Hi Jonathan, On 11/14/22 14:14, Jonathan Wakely wrote: On Mon, 14 Nov 2022 at 11:38, Alejandro Colomar via Gcc wrote: Hi Andrew! On 11/13/22 23:12, Andrew Pinski wrote: On Sun, Nov 13, 2022 at 1:57 PM Alejandro Colomar via Gcc wrote: Hi! I'd like to get warnings if I write the following

unterminated string literals (was: [whish] -Wunterminated-string-initialization: new warning)

2022-11-14 Thread Alejandro Colomar via Gcc
Hi Jonathan, On 11/14/22 14:14, Jonathan Wakely wrote: On Mon, 14 Nov 2022 at 11:38, Alejandro Colomar via Gcc wrote: BTW, I had another idea to add a suffix to string literals to make them unterminated: char foo[3] = "foo"u; // OK char bar[4] = "bar"; // OK char baz[4] = "baz"u; // Warn

Re: [whish] -Wunterminated-string-initialization: new warning

2022-11-14 Thread Jonathan Wakely via Gcc
On Mon, 14 Nov 2022 at 11:38, Alejandro Colomar via Gcc wrote: > > Hi Andrew! > > On 11/13/22 23:12, Andrew Pinski wrote: > > On Sun, Nov 13, 2022 at 1:57 PM Alejandro Colomar via Gcc > > wrote: > >> > >> Hi! > >> > >> I'd like to get warnings if I write the following code: > >> > >> char foo[3]

Re: [whish] -Wunterminated-string-initialization: new warning

2022-11-14 Thread Alejandro Colomar via Gcc
Hi Andrew! On 11/13/22 23:12, Andrew Pinski wrote: On Sun, Nov 13, 2022 at 1:57 PM Alejandro Colomar via Gcc wrote: Hi! I'd like to get warnings if I write the following code: char foo[3] = "foo"; This should be easy to add as it is already part of the -Wc++-compat option as for C++ it is

Re: [whish] -Wunterminated-string-initialization: new warning

2022-11-13 Thread Andrew Pinski via Gcc
On Sun, Nov 13, 2022 at 1:57 PM Alejandro Colomar via Gcc wrote: > > Hi! > > I'd like to get warnings if I write the following code: > > char foo[3] = "foo"; This should be easy to add as it is already part of the -Wc++-compat option as for C++ it is invalid code. :2:19: warning: initializer-str

[whish] -Wunterminated-string-initialization: new warning

2022-11-13 Thread Alejandro Colomar via Gcc
Hi! I'd like to get warnings if I write the following code: char foo[3] = "foo"; It's hard to keep track of sizes to make sure that the string literals always initialize to terminated strings. It seems something that should be easy to implement in the compiler. A morecomplex case where it'