"Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at> writes:
> The PG_FUNCTION_INFO_V1 macro produces an annoying warning, that I
> cannot interpret:
> xlc -O2 -qmaxmem=16384 -qsrcmsg -qlonglong -DREFINT_VERBOSE -I.
> -I../../src/include -I/usr/local/include -c -o autoinc.o autoinc.c
> 8 | extern Pg_finfo_record * pg_finfo_autoinc (void);
> Pg_finfo_record * pg_finfo_a
> utoinc (void) { static Pg_finfo_record my_finfo = { 1 }; return
> &my_finfo; };
> ........................................................................
> ......
> ........................................................................
> ....a
> a - 1506-137 (E) Declaration must declare at least one declarator, tag,
> or the members of
> an enumeration.
It's not so much the macro as the semicolon after it. I get "Empty
declaration" warnings from HP's cc for those lines myself. Kind of
annoying, but not writing the semicolon in the source sounds uglier.
Is it worth adding a dummy declaration to the macro just to shut up
these compilers? We could probably make the macro produce bogus
extern declarations, say PG_FUNCTION_INFO_V1(foo) produces
extern Pg_finfo_record * pg_finfo_foo (void);
Pg_finfo_record * pg_finfo_foo (void)
{ static Pg_finfo_record my_finfo = { 1 }; return &my_finfo;
}
extern int pg_finfo_foo_dummy
which would satisfy even the most pedantic compiler ... unless it
chose to warn about unreferenced extern declarations, but I don't
think any do.
regards, tom lane