From: | Mark Dilger <hornschnorter(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net> |
Subject: | Re: pg_recvlogical.c doesn't build with --disable-integer-datetimes |
Date: | 2017-02-17 21:13:10 |
Message-ID: | B9FB1155-B39D-43C9-A7E6-B67E1C59E4CE@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> On Feb 17, 2017, at 12:21 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> writes:
>> On Sat, Feb 18, 2017 at 9:04 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> [ pokes around... ] Ah, that's called COPT, and it's entirely
>>> undocumented :-(. Probably ought to fix that.
>
>> One way to set that up is like this:
>
>> $ cat src/Makefile.custom
>> COPT=-Wall -Werror $(CC_OPT)
Makefile.custom is deprecated per comment in src/Makefile.global, so
you'd at least have to remove or edit that comment. It was enough to
scare me off using Makefile.custom as a solution for this when I was
working on getting -Werror into all my builds.
> Well, we don't document Makefile.custom either, and probably now is
> not the time to start. I'm inclined to just explain that you can
> set COPT in the environment of the "make" step to add flags that
> you couldn't or didn't tell configure about.
There is a test in configure.in for whether the compiler is GCC, followed
by additional flags if so. On my platform (Mac laptop) I was able to add
additional flags against HEAD without any of them actually triggering a
warning (though my last merge from HEAD was a while ago):
diff --git a/configure.in b/configure.in
index b9831bc..d6e7e24 100644
--- a/configure.in
+++ b/configure.in
@@ -446,6 +446,24 @@ fi
if test "$GCC" = yes -a "$ICC" = no; then
CFLAGS="-Wall -Wmissing-prototypes -Wpointer-arith"
+ PGAC_PROG_CC_CFLAGS_OPT([-Wempty-body])
+ PGAC_PROG_CC_CFLAGS_OPT([-Wignored-qualifiers])
+ PGAC_PROG_CC_CFLAGS_OPT([-Wimplicit-fallthrough])
+ PGAC_PROG_CC_CFLAGS_OPT([-Wtype-limits])
+ PGAC_PROG_CC_CFLAGS_OPT([-Wuninitialized])
+ PGAC_PROG_CC_CFLAGS_OPT([-Wshift-negative-value])
+ PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-include-dirs])
+ PGAC_PROG_CC_CFLAGS_OPT([-Wshift-overflow])
+ PGAC_PROG_CC_CFLAGS_OPT([-Wswitch-default])
+ PGAC_PROG_CC_CFLAGS_OPT([-Wdangling-else])
+ PGAC_PROG_CC_CFLAGS_OPT([-Waggregate-return])
+ PGAC_PROG_CC_CFLAGS_OPT([-Wstrict-prototypes])
+ PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-declarations])
+ PGAC_PROG_CC_CFLAGS_OPT([-Wredundant-decls])
+ PGAC_PROG_CC_CFLAGS_OPT([-Winline])
+ PGAC_PROG_CC_CFLAGS_OPT([-Woverlength-strings])
+ PGAC_PROG_CC_CFLAGS_OPT([-Wc++-compat])
+ PGAC_PROG_CC_CFLAGS_OPT([-Wold-style-definition])
# These work in some but not all gcc versions
PGAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement])
PGAC_PROG_CC_CFLAGS_OPT([-Wendif-labels])
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index d39d6ca..96fbc60 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -240,7 +240,7 @@ endif # not PGXS
CC = @CC@
GCC = @GCC@
SUN_STUDIO_CC = @SUN_STUDIO_CC@
-CFLAGS = @CFLAGS@
+CFLAGS = @CFLAGS@ -Werror
CFLAGS_VECTOR = @CFLAGS_VECTOR@
CFLAGS_SSE42 = @CFLAGS_SSE42@
How about we add (some of) these extra warnings, plus -Werror,
in a section that is only active for platforms/compilers where we
know there aren't spurious warnings? That would make detecting
unintentionally introduced warnings simpler, without the use of
COPT. Perhaps where the compiler is GCC or CLANG, and the
platform is x86_64 redhat, something like that?
Mark Dilger
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2017-02-17 21:18:19 | Re: pg_recvlogical.c doesn't build with --disable-integer-datetimes |
Previous Message | Tom Lane | 2017-02-17 20:21:05 | Re: pg_recvlogical.c doesn't build with --disable-integer-datetimes |