Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1riWMh-0001um-VE for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Mar 2024 09:18:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1riWMg-00BPeB-7T for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Mar 2024 09:18:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1riWMf-00BPe3-3Q for pgsql-hackers@lists.postgresql.org; Fri, 08 Mar 2024 09:18:06 +0000 Received: from mail.clear-code.com ([153.126.206.245]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1riWMV-003PgL-JI for pgsql-hackers@postgresql.org; Fri, 08 Mar 2024 09:18:04 +0000 Received: from localhost (unknown [IPv6:2404:7a80:89c1:1200:6af9:2266:1443:f149]) by mail.clear-code.com (Postfix) with ESMTPSA id 6B896614704; Fri, 8 Mar 2024 18:17:49 +0900 (JST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.clear-code.com 6B896614704 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=clear-code.com; s=default; t=1709889469; bh=Z8urG6ui4WSghtE7R7TFK4RoCW5pfFC6g3k9BdYxXc8=; h=Date:To:Cc:Subject:From:In-Reply-To:References:From; b=ht1B+WY8KirD6UXO8pHCXPDBm9qiweIkRZwBrHOFhF0eUWTAsJyJYl2fHBbPmMSQU JtAqPyAIA6S0j+74W9psh4UcXbwAJfw7hVsOhlXjKrUPYhLgouYKRcjTENGFOw05x0 9pLQZAzqcnzR3BAWxCbExp5Qpri4q80Y6LdIVTgo= Date: Fri, 08 Mar 2024 18:17:47 +0900 (JST) Message-Id: <20240308.181747.1268524814821679071.kou@clear-code.com> To: michael@paquier.xyz Cc: tristan@neon.tech, pgsql-hackers@postgresql.org Subject: Re: meson: Specify -Wformat as a common warning flag for extensions From: Sutou Kouhei In-Reply-To: References: <20240122.141139.931086145628347157.kou@clear-code.com> X-Mailer: Mew version 6.8 on Emacs 29.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Rspamd-Server: mail.clear-code.com X-Rspamd-Queue-Id: 6B896614704 X-Rspamd-Action: no action X-Spamd-Result: default: False [1.40 / 999.00]; MID_CONTAINS_FROM(1.00)[]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_ZERO(0.00)[0]; ARC_NA(0.00)[]; ASN(0.00)[asn:2518, ipnet:2404:7a80::/29, country:JP]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; URIBL_BLOCKED(0.00)[postgresql.org:url,gnu.org:url,localhost:helo,paquier.xyz:email]; FROM_EQ_ENVFROM(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_DN_NONE(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; SURBL_MULTI_FAIL(0.00)[paquier.xyz:server fail,postgresql.org:server fail,localhost:server fail,gnu.org:server fail] List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, In "Re: meson: Specify -Wformat as a common warning flag for extensions" on Fri, 8 Mar 2024 15:32:22 +0900, Michael Paquier wrote: > Are there version and/or > environment requirements to be aware of? I'm using Debian GNU/Linux sid and I can reproduce with gcc 8-13: $ for x in {8..13}; do; echo gcc-${x}; gcc-${x} -Wformat-security -E - < /dev/null > /dev/null; done gcc-8 cc1: warning: -Wformat-security ignored without -Wformat [-Wformat-security] gcc-9 cc1: warning: '-Wformat-security' ignored without '-Wformat' [-Wformat-security] gcc-10 cc1: warning: '-Wformat-security' ignored without '-Wformat' [-Wformat-security] gcc-11 cc1: warning: '-Wformat-security' ignored without '-Wformat' [-Wformat-security] gcc-12 cc1: warning: '-Wformat-security' ignored without '-Wformat' [-Wformat-security] gcc-13 cc1: warning: '-Wformat-security' ignored without '-Wformat' [-Wformat-security] $ I tried this on Ubuntu 22.04 too but this isn't reproduced: $ gcc-11 -Wformat-security -E - < /dev/null > /dev/null $ It seems that Ubuntu enables -Wformat by default: $ gcc-11 -Wno-format -Wformat-security -E - < /dev/null > /dev/null cc1: warning: '-Wformat-security' ignored without '-Wformat' [-Wformat-security] I tried this on AlmaLinux 9 too and this is reproduced: $ gcc --version gcc (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ gcc -Wformat-security -E - < /dev/null > /dev/null cc1: warning: '-Wformat-security' ignored without '-Wformat' [-Wformat-security] > Forcing -Wformat implies more stuff that can be disabled with > -Wno-format-contains-nul, -Wno-format-extra-args, and > -Wno-format-zero-length, but the thing is that we're usually very > conservative with such additions in the scripts. See also > 8b6f5f25102f, done, I guess, as an answer to this thread: > https://www.postgresql.org/message-id/4D431505.9010002%40dunslane.net I think that this is not a problem. Because the comment added by 8b6f5f25102f ("This was included in -Wall/-Wformat in older GCC versions") implies that we want to always use -Wformat-security. -Wformat-security isn't worked without -Wformat: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wformat-security > If -Wformat is specified, also warn about uses of format > functions that represent possible security problems. Thanks, -- kou