On Tue, Mar 05, 2024 at 09:20:42PM +0100, Alejandro Colomar wrote: > Hi! > > v6: > - Small wording fix in c.opt > - Document the option in invoke.texi > > I tried again, but didn't find much alphabetic order in there, so put > it where Mike suggested, after -Warray-bounds=n. > > Have a lovely night! > Alex > [...] > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi > index 146b40414b0..f81df4de934 100644 > --- a/gcc/doc/invoke.texi > +++ b/gcc/doc/invoke.texi > @@ -410,7 +410,9 @@ Objective-C and Objective-C++ Dialects}. > -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs > -Wtrivial-auto-var-init -Wtsan -Wtype-limits -Wundef > -Wuninitialized -Wunknown-pragmas > --Wunsuffixed-float-constants -Wunused > +-Wunsuffixed-float-constants > +-Wunterminated-string-initialization > +-Wunused > -Wunused-but-set-parameter -Wunused-but-set-variable > -Wunused-const-variable -Wunused-const-variable=@var{n} > -Wunused-function -Wunused-label -Wunused-local-typedefs > @@ -6264,6 +6266,7 @@ name is still supported, but the newer name is more > descriptive.) > -Wredundant-move @r{(only for C++)} > -Wtype-limits > -Wuninitialized > +-Wunterminated-string-initialization > -Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)} > -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} > @option{-Wall}@r{)} > -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} > @option{-Wall}@r{)}} > @@ -8281,6 +8284,20 @@ arithmetic that may yield out of bounds values. This > warning level may > give a larger number of false positives and is deactivated by default. > @end table > > +@opindex Wunterminated-string-initialization > +@opindex Wno-unterminated-string-initialization > +@item -Wunterminated-string-initialization > +Warn about character arrays > +initialized as unterminated character sequences > +with a string literal. > +For example: > + > +@smallexample > +char arr[3] = "foo"; > +@end smallexample > + > +@option{-Wunterminated-string-initialization} is enabled by @option{-Wextra}.
Oops, I should also mention -Wc++-compat here. -- <https://www.alejandro-colomar.es/> Looking for a remote C programming job at the moment.
signature.asc
Description: PGP signature