From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by sourceware.org (Postfix) with ESMTPS id B4C233858C98 for ; Tue, 5 Mar 2024 20:25:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B4C233858C98 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B4C233858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=139.178.84.217 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709670351; cv=none; b=xZRIaqxfA2wh57XGDxjebBod+Sw0nJ3EePRzfqESDxf9kHYmf731BEeUJGi6dkMxLH73dCw+D2O+808osJVM+/8NIR2Y5C8xZ1M5W/K395gBXj6g5ko35gRiGHZZJSOLk3idpI1FhiTFV4N3disJnfn6CtZnLSHbUbY240/URx0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709670351; c=relaxed/simple; bh=Oe27Nn+64cpYhsoHA53Llk/g75RiVKpXYtftBTSRkTE=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=LaR7eV3XH+PDeePScm+7/A7mXyDH/fUo9+9wriGzCUfOwdFJc67LA4bl0VYOLiXBFRR2q2H3bdCG0XZw5F7WgtTLLd/SggFr0MadsdBPXtKbVGNDKpPvV94SHdAIHSx1SKjmDMBOJJa/dQASN/w4wsvkciEg7TTwKILd7htVBXQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 5B9DE61126 for ; Tue, 5 Mar 2024 20:25:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77039C433C7 for ; Tue, 5 Mar 2024 20:25:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709670349; bh=Oe27Nn+64cpYhsoHA53Llk/g75RiVKpXYtftBTSRkTE=; h=Date:From:To:Subject:References:In-Reply-To:From; b=AlLt3ni8OkKPR4UyeaSFElBDTuR8XJ41stioX//pnyLFkBTY5VBxVvnN8C0/H8jiz he1pozw5Dz8wW6X11Ce5nYDo8avI2l3PxPS/46TH9WxJ9CyEAZRmcCUt9x5UvKGLNk PEZgpD1XjD+ncZFmyKn9KSOHMjn5YgnIjKHFExXRxzq/qWvmLtmxGG87YzM7ZABZeJ dNZN5+PO8i9BczaGWZ4DDbfqlPi2S6U5Klyk+xzFiC3T7FVrKWwSCYIc7qccs+kTd1 Yi5xEpK/s0dFDyI9esTtjIEMGKBGkTEMOiRSEwTZbkYKz8D3IKjKR5x5jF1+gebtLD fIZmcSIOTHPsg== Date: Tue, 5 Mar 2024 21:25:45 +0100 From: Alejandro Colomar To: gcc-patches@gcc.gnu.org Subject: Re: [PATCH v6] C, ObjC: Add -Wunterminated-string-initialization Message-ID: References: <20240305202039.21125-1-alx@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="CAwTbZ14Kch5+OeK" Content-Disposition: inline In-Reply-To: <20240305202039.21125-1-alx@kernel.org> X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --CAwTbZ14Kch5+OeK Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Tue, 5 Mar 2024 21:25:45 +0100 From: Alejandro Colomar To: gcc-patches@gcc.gnu.org Subject: Re: [PATCH v6] C, ObjC: Add -Wunterminated-string-initialization On Tue, Mar 05, 2024 at 09:20:42PM +0100, Alejandro Colomar wrote: > Hi! >=20 > v6: > - Small wording fix in c.opt > - Document the option in invoke.texi >=20 > I tried again, but didn't find much alphabetic order in there, so put > it where Mike suggested, after -Warray-bounds=3Dn. >=20 > Have a lovely night! > Alex >=20 [...] > 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=3D@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} @opti= on{-Wall}@r{)}} > @@ -8281,6 +8284,20 @@ arithmetic that may yield out of bounds values. Th= is warning level may > give a larger number of false positives and is deactivated by default. > @end table > =20 > +@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] =3D "foo"; > +@end smallexample > + > +@option{-Wunterminated-string-initialization} is enabled by @option{-Wex= tra}. Oops, I should also mention -Wc++-compat here. --=20 Looking for a remote C programming job at the moment. --CAwTbZ14Kch5+OeK Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmXnf8kACgkQnowa+77/ 2zLoJw/+OgxeDnvTjVMqP4iMwNhz+Ka1mwQMDHfodbGOBVy2ODthZM12RTMgpIdX iyYOgeLUjkHmWJKxgZvi5YCNtktocBYH0Yq2D2W2Az0pMhWO1AYEDuJrStueMeI4 kGH45moI7qreD+61qyDtFFpVIIJ3nbGqJn9xI2Ts0Lt/TFff/2xTCwLf/ShdqDCj NB2S8sISwrf7xesn9/eIl+H2XM407E2NqzlojJPyeJtgvtgcOtWMA+MFpA+8rQZW i94MdIGj04V+NuQedfbeLI6eluNmK31bi5F9aI0bNbuZD9qr3XofE/UTEjAJ6D/j C4i7ZooB9b9F2FlArcuDIQhfsRF1Z6RzjeRzlFTozqMKUPpMvNAA2hLm0CHv8+iF 7k0nQG8scP0K2D48bDAOWArlUoiyRyKpurUppyVYFLcw37Zo+svjeufFyGA1S8L5 Z9kltemlISzQ5273cULvPePEMhnbm8slAqZ29qnky5+9t/3dgOdTuNrRwlB1AdJC FJFUcd6IrC95gDvdsk5dxCud50P5xQVN2sL9h4mHd1nT6y0UcRPR1ySbYywV2Ceq sf15xV9mmlBO1/hEQ1v0lAprvqYmZeWGdm2w9uMlx+8fvkjAga9FCviFZPJoHgIm WITmAc8t7Dwu3XHafVYTei8AnY5Xt5kcBgNBpgX8n0f3JqNWZAk= =gS0I -----END PGP SIGNATURE----- --CAwTbZ14Kch5+OeK--