wttw/pgpsl

C99 mode?

Closed this issue · 2 comments

Hello!
I have the following issue with pgpsl extension:

root@2a9570322f0# make USE_PGXS=1
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIC -pie -fno-omit-frame-pointer -fPIC -I. -I./ -I/usr/include/postgresql/10/server -I/usr/include/postgresql/internal -I/usr/include/x86_64-linux-gnu   -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o src/regdom.o src/regdom.c
src/regdom.c: In function 'parseTldNode':
src/regdom.c:113:9: error: 'for' loop initial declarations are only allowed in C99 mode
         for (unsigned long i = 0; i < nchildren; i++)
         ^
src/regdom.c:113:9: note: use option -std=c99 or -std=gnu99 to compile your code
src/regdom.c: In function 'printTldTreeI':
src/regdom.c:152:9: error: 'for' loop initial declarations are only allowed in C99 mode
         for (unsigned int i = 0; i < node->num_children; i++)
         ^
src/regdom.c: In function 'freeTldTreeI':
src/regdom.c:168:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (unsigned int i = 0; i < node->num_children; i++)
     ^
src/regdom.c: In function 'findTldNode':
src/regdom.c:187:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (unsigned int i = 0; i < parent->num_children; i++)
     ^
src/regdom.c: In function 'getRegisteredDomainDropI':
src/regdom.c:212:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     const char *head = hostname;
     ^
src/regdom.c:227:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
         const tldnode *subtree = findTldNode(tree, seg_start, seg_end);
         ^
make: *** [src/regdom.o] Error 1

Ubuntu 14.04 (docker)
My pg_config:

root@2a9570322f0a# pg_config
BINDIR = /usr/lib/postgresql/10/bin
DOCDIR = /usr/share/doc/postgresql-doc-10
HTMLDIR = /usr/share/doc/postgresql-doc-10
INCLUDEDIR = /usr/include/postgresql
PKGINCLUDEDIR = /usr/include/postgresql
INCLUDEDIR-SERVER = /usr/include/postgresql/10/server
LIBDIR = /usr/lib/x86_64-linux-gnu
PKGLIBDIR = /usr/lib/postgresql/10/lib
LOCALEDIR = /usr/share/locale
MANDIR = /usr/share/postgresql/10/man
SHAREDIR = /usr/share/postgresql/10
SYSCONFDIR = /etc/postgresql-common
PGXS = /usr/lib/postgresql/10/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--with-icu' '--with-tcl' '--with-perl' '--with-python' '--with-pam' '--with-openssl' '--with-libxml' '--with-libxslt' '--with-tclconfig=/usr/lib/x86_64-linux-gnu/tcl8.6' '--with-includes=/usr/include/tcl8.6' 'PYTHON=/usr/bin/python' '--mandir=/usr/share/postgresql/10/man' '--docdir=/usr/share/doc/postgresql-doc-10' '--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share/' '--datadir=/usr/share/postgresql/10' '--bindir=/usr/lib/postgresql/10/bin' '--libdir=/usr/lib/x86_64-linux-gnu/' '--libexecdir=/usr/lib/postgresql/' '--includedir=/usr/include/postgresql/' '--with-extra-version= (Ubuntu 10.3-1.pgdg14.04+1)' '--enable-nls' '--enable-integer-datetimes' '--enable-thread-safety' '--enable-tap-tests' '--enable-debug' '--disable-rpath' '--with-uuid=e2fs' '--with-gnu-ld' '--with-pgport=5432' '--with-system-tzdata=/usr/share/zoneinfo' 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIC -pie -fno-omit-frame-pointer' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now' '--with-gssapi' '--with-ldap' '--with-includes=/usr/include/mit-krb5' '--with-libs=/usr/lib/mit-krb5' '--with-libs=/usr/lib/x86_64-linux-gnu/mit-krb5' '--with-selinux' 'CPPFLAGS=-D_FORTIFY_SOURCE=2'
CC = gcc
CPPFLAGS = -DFRONTEND -I/usr/include/x86_64-linux-gnu -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/mit-krb5
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIC -pie -fno-omit-frame-pointer
CFLAGS_SL = -fPIC
LDFLAGS = -L../../src/common -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -L/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,--as-needed
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lpthread -lselinux -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -ledit -lrt -lcrypt -ldl -lm
VERSION = PostgreSQL 10.3 (Ubuntu 10.3-1.pgdg14.04+1)

Thanks!

wttw commented

Should be a fairly simple fix - I just need to get things set up so I can replicate it. Meanwhile, I'd guess that adding PG_CPPFLAGS=-std=c99 to the top of the Makefile would work.

wttw commented

Should be fixed in 1e8069c.