pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedLocation to specify C compiler option in C extension
3+ messages / 2 participants
[nested] [flat]
* Location to specify C compiler option in C extension
@ 2018-02-23 18:35 Demitri Muna <postgresql@demitri.com>
0 siblings, 1 reply; 3+ messages in thread
From: Demitri Muna @ 2018-02-23 18:35 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hi,
I’m writing a C extension and have successfully based my Makefile on existing templates. This conveniently hides the details of the full Makefile provided by "pg_config --pgxs”. Which variable would be the appropriate one to specify the ‘-std=c99’ compiler flag? I’ve tried many and still get warnings that this flag should suppress (specifically, "ISO C90 forbids mixed declarations and code”). These are the variables I currently define:
EXTENSION
DATA
PGFILEDESC
MODULE_big
PG_CPPFLAGS (this one seemed like the right place)
SHLIB_LINK
OBJS
PG_CONFIG
PGXS
A workaround has been:
OBJS = file1.o file2.o CPPFLAGS+=-Wdeclaration-after-statement
but it’s not exactly the same thing.
Thanks,
Demitri
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Location to specify C compiler option in C extension
@ 2018-02-23 19:09 Tom Lane <tgl@sss.pgh.pa.us>
parent: Demitri Muna <postgresql@demitri.com>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2018-02-23 19:09 UTC (permalink / raw)
To: Demitri Muna <postgresql@demitri.com>; +Cc: pgsql-general@lists.postgresql.org
Demitri Muna <postgresql@demitri.com> writes:
> I’m writing a C extension and have successfully based my Makefile on existing templates. This conveniently hides the details of the full Makefile provided by "pg_config --pgxs”. Which variable would be the appropriate one to specify the ‘-std=c99’ compiler flag? I’ve tried many and still get warnings that this flag should suppress (specifically, "ISO C90 forbids mixed declarations and code”). These are the variables I currently define:
PG_CPPFLAGS ought to work. One point is that you need to set that before
including pgxs.mk; maybe it's an ordering problem?
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Location to specify C compiler option in C extension
@ 2018-02-23 21:23 Demitri Muna <postgresql@demitri.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Demitri Muna @ 2018-02-23 21:23 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hi Tom,
> PG_CPPFLAGS ought to work. One point is that you need to set that before
> including pgxs.mk; maybe it's an ordering problem?
On closer inspection, it was working, but the pg Makefile was specifically including “-Wdeclaration-after-statement” which I think was overriding the ‘-std=c99’ part. The line below fixed the problem.
PG_CPPFLAGS += -std=c99 -Wno-declaration-after-statement
Thanks, sorry for the noise.
Demitri
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2018-02-23 21:23 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-02-23 18:35 Location to specify C compiler option in C extension Demitri Muna <postgresql@demitri.com>
2018-02-23 19:09 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-02-23 21:23 ` Demitri Muna <postgresql@demitri.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox