Re: GCC 8 warnings
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, Devrim Gündüz <devrim@gunduz.org>, pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-06-16T18:52:18Z
Lists: pgsql-hackers
Hi, On 2018-06-16 13:29:55 -0400, Tom Lane wrote: > I propose the attached patch to disable these warnings if the compiler > knows the switch for them. I did not turn them off for CXX though; > anyone think there's a need to? No, not for now. I don't think it's likely that the amount of C++ will grow significantly anytime soon. And it seems unlikely that the llvm interfacing code will use C stringops. Not that I think it'd hurt much to add it. > Probably all of this ought to be back-patched as applicable, since > people will doubtless try to compile back branches with gcc 8. Yea, It's already pretty annoying. > diff --git a/configure.in b/configure.in > index 862d8b128d..dae29a4ab1 100644 > --- a/configure.in > +++ b/configure.in > @@ -502,6 +502,15 @@ if test "$GCC" = yes -a "$ICC" = no; then > if test -n "$NOT_THE_CFLAGS"; then > CFLAGS="$CFLAGS -Wno-unused-command-line-argument" > fi > + # Similarly disable useless truncation warnings from gcc 8+ > + PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wformat-truncation]) > + if test -n "$NOT_THE_CFLAGS"; then > + CFLAGS="$CFLAGS -Wno-format-truncation" > + fi > + PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wstringop-truncation]) > + if test -n "$NOT_THE_CFLAGS"; then > + CFLAGS="$CFLAGS -Wno-stringop-truncation" > + fi I've not had a lot of coffee yet this morning, but couldn't there be an issue where a compiler supported one of these flags? Because NOT_THE_CFLAGS is reused, it'd trigger lateron as well, right? Seems to me we'd need to reset it. Greetings, Andres Freund
Commits
-
Use -Wno-format-truncation and -Wno-stringop-truncation, if available.
- ec5547e563a8 9.3.24 landed
- e716585235b1 11.0 landed
- 817d605e411f 9.4.19 landed
- 416e3e318cc4 10.5 landed
- 14b69a532197 9.5.14 landed
- 119290be6fe3 9.6.10 landed
-
Avoid unnecessary use of strncpy in a couple of places in ecpg.
- 537d7f3e1875 9.3.24 landed
- cd56194d189d 9.4.19 landed
- 8b444a353975 9.5.14 landed
- 58065f9eed68 9.6.10 landed
- 8c924855456e 10.5 landed
- 6b74f5eaadc4 11.0 landed
-
Use snprintf not sprintf in pg_waldump's timestamptz_to_str.
- fd079dd0915a 9.4.19 landed
- f3be5d3e7891 9.5.14 landed
- 8870e2978fc5 9.6.10 landed
- 5d923eb29bb6 11.0 landed
- 3243cbc085b8 9.3.24 landed
- 18933261589c 10.5 landed