master, static inline and #ifndef FRONTEND - Mailing list pgsql-hackers

From Andres Freund
Subject master, static inline and #ifndef FRONTEND
Date
Msg-id 20180824154237.mabsv6fsz5q37bma@alap3.anarazel.de
Whole thread Raw
Responses Re: master, static inline and #ifndef FRONTEND
List pgsql-hackers
Hi,

In a recent commit [1] I added a static inline which castoroides
dislikes:
cc -D_STDC_C99= -Xa -g -m64 -xarch=native -xdepend -xO4 -xprefetch=auto,explicit pg_waldump.o compat.o xlogreader.o
rmgrdesc.obrindesc.o clogdesc.o committsdesc.o dbasedesc.o genericdesc.o gindesc.o gistdesc.o hashdesc.o heapdesc.o
logicalmsgdesc.omxactdesc.o nbtdesc.o relmapdesc.o replorigindesc.o seqdesc.o smgrdesc.o spgdesc.o standbydesc.o
tblspcdesc.oxactdesc.o xlogdesc.o -L../../../src/port -L../../../src/common
-Wl,-R'/export/home/dpage/pgbuildfarm/castoroides/HEAD/inst/lib' -lpgcommon -lpgport -lpam -lgss -lz -lnsl -lrt
-lsocket-lm  -o pg_waldump
 
Undefined            first referenced
 symbol                  in file
slot_getsomeattrs                   rmgrdesc.o

So it's the "old" issue of static inlines referencing functions that
aren't present, which newer compilers don't have.

It's obviously trivial to fix this case with by adding an #ifndef
FRONTEND. But as castoroides appears to be the only animal showing the
problem - after subtracting the animals dead due to the C99 requirement
- I wonder if we shouldn't just require "proper" static inline
support. castoroides runs a 13yo OS, and newer compilers that do not
have the problem are readily available.

I think it's very likely that we'll add more and more static inlines,
and having to either experimentally check via the buildfarm, or just add
#ifndef FRONTEND everywhere is pretty annoying.

Greetings,

Andres Freund

[1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=88ebd62fcc2ea7c55c0858f6dd4800d51383529f
[2] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=castoroides&dt=2018-08-24%2012%3A03%3A05


pgsql-hackers by date:

Previous
From: Konstantin Knizhnik
Date:
Subject: Re: [HACKERS] Cached plans and statement generalization
Next
From: Andres Freund
Date:
Subject: Re: Windows vs C99 (was Re: C99 compliance for src/port/snprintf.c)