From: Alejandro Colomar <alx@kernel.org>
To: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH v6] C, ObjC: Add -Wunterminated-string-initialization
Date: Tue, 5 Mar 2024 21:25:45 +0100 [thread overview]
Message-ID: <Zed_yhjTwKDC9vJu@debian> (raw)
In-Reply-To: <20240305202039.21125-1-alx@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 2273 bytes --]
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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-03-05 20:25 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-24 13:39 [PATCH v2] " Alejandro Colomar
2023-03-24 14:53 ` David Malcolm
2023-03-24 17:45 ` Alejandro Colomar
2023-03-24 17:58 ` David Malcolm
2023-04-20 17:17 ` Ping: " Alejandro Colomar
2023-10-01 0:55 ` Alejandro Colomar
2023-10-01 7:37 ` Martin Uecker
2023-10-01 11:35 ` Alejandro Colomar
2023-10-01 11:38 ` [PATCH v3] " Alejandro Colomar
2023-10-01 11:41 ` [PATCH v4] " Alejandro Colomar
2023-10-01 16:24 ` [PATCH v5] " Alejandro Colomar
2023-10-08 13:05 ` Ping: " Alejandro Colomar
2023-11-13 9:55 ` Alejandro Colomar
2024-02-06 10:45 ` [PATCH v5 RESEND] " Alejandro Colomar
2024-02-25 18:10 ` Mike Stump
2024-02-25 19:44 ` Alejandro Colomar
2024-02-26 15:27 ` Joseph Myers
2024-02-26 15:24 ` Joseph Myers
2024-02-26 15:56 ` Alejandro Colomar
2024-02-26 16:19 ` Joseph Myers
2024-02-26 19:54 ` Sandra Loosemore
2024-02-26 19:32 ` Mike Stump
2024-03-05 20:20 ` [PATCH v6] " Alejandro Colomar
2024-03-05 20:25 ` Alejandro Colomar [this message]
2024-03-05 20:33 ` [PATCH v7] " Alejandro Colomar
2024-03-05 22:42 ` Sandra Loosemore
2024-03-06 18:43 ` [PATCH v8] " Alejandro Colomar
2024-05-14 18:16 ` Alejandro Colomar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zed_yhjTwKDC9vJu@debian \
--to=alx@kernel.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).