Re: [HACKERS] pg_recvlogical.c doesn't build with --disable-integer-datetimes

Поиск
Список
Период
Сортировка
От Mark Dilger
Тема Re: [HACKERS] pg_recvlogical.c doesn't build with --disable-integer-datetimes
Дата
Msg-id B9FB1155-B39D-43C9-A7E6-B67E1C59E4CE@gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] pg_recvlogical.c doesn't build with --disable-integer-datetimes  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] pg_recvlogical.c doesn't build with --disable-integer-datetimes  (Andres Freund <andres@anarazel.de>)
Re: [HACKERS] pg_recvlogical.c doesn't build with --disable-integer-datetimes  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [HACKERS] pg_recvlogical.c doesn't build with--disable-integer-datetimes  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
> On Feb 17, 2017, at 12:21 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
> Thomas Munro <thomas.munro@enterprisedb.com> writes:
>> On Sat, Feb 18, 2017 at 9:04 AM, Tom Lane <tgl@sss.pgh.pa.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 @@ fiif 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 PGXSCC = @CC@GCC = @GCC@SUN_STUDIO_CC = @SUN_STUDIO_CC@
-CFLAGS = @CFLAGS@
+CFLAGS = @CFLAGS@ -WerrorCFLAGS_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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] pg_recvlogical.c doesn't build with --disable-integer-datetimes
Следующее
От: Andres Freund
Дата:
Сообщение: Re: [HACKERS] pg_recvlogical.c doesn't build with --disable-integer-datetimes