From: | Sutou Kouhei <kou(at)clear-code(dot)com> |
---|---|
To: | michael(at)paquier(dot)xyz |
Cc: | tristan(at)neon(dot)tech, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: meson: Specify -Wformat as a common warning flag for extensions |
Date: | 2024-03-08 09:17:47 |
Message-ID: | 20240308.181747.1268524814821679071.kou@clear-code.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
In <Zeqw9vGrYlb250aO(at)paquier(dot)xyz>
"Re: meson: Specify -Wformat as a common warning flag for extensions" on Fri, 8 Mar 2024 15:32:22 +0900,
Michael Paquier <michael(at)paquier(dot)xyz> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Dean Rasheed | 2024-03-08 09:33:19 | Re: vacuumdb/clusterdb/reindexdb: allow specifying objects to process in all databases |
Previous Message | walther | 2024-03-08 08:41:53 | Re: MERGE ... RETURNING |