From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Generate pg_stat_get_* functions with Macros |
Date: | 2022-12-10 02:43:56 |
Message-ID: | 1188769.1670640236@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
This series of patches has caused buildfarm member wrasse to
start complaining about "empty declarations":
wrasse | 2022-12-09 21:08:33 | "/export/home/nm/farm/studio64v12_6/HEAD/pgsql.build/../pgsql/src/backend/utils/adt/pgstatfuncs.c", line 56: warning: syntax error: empty declaration
wrasse | 2022-12-09 21:08:33 | "/export/home/nm/farm/studio64v12_6/HEAD/pgsql.build/../pgsql/src/backend/utils/adt/pgstatfuncs.c", line 59: warning: syntax error: empty declaration
wrasse | 2022-12-09 21:08:33 | "/export/home/nm/farm/studio64v12_6/HEAD/pgsql.build/../pgsql/src/backend/utils/adt/pgstatfuncs.c", line 62: warning: syntax error: empty declaration
[ etc etc ]
Presumably it could be silenced by removing the semicolons after
the new macro calls:
/* pg_stat_get_analyze_count */
PG_STAT_GET_RELENTRY_INT64(analyze_count);
/* pg_stat_get_autoanalyze_count */
PG_STAT_GET_RELENTRY_INT64(autoanalyze_count);
/* pg_stat_get_autovacuum_count */
PG_STAT_GET_RELENTRY_INT64(autovacuum_count);
I wondered if that would confuse pgindent, but a quick check
says no. (The blank lines in between may be helping.)
While I'm nitpicking, I think that the way you've set up the
macro definitions is a bit dangerous:
#define PG_STAT_GET_RELENTRY_INT64(stat) \
Datum \
CppConcat(pg_stat_get_,stat)(PG_FUNCTION_ARGS) \
{ \
... \
PG_RETURN_INT64(result); \
} \
The backslash after the last right brace means that the line
following that is part of the macro body. This does no harm as
long as said line is blank ... but I think it's a foot-gun
waiting to bite somebody, because visually you'd think the macro
ends with the brace. So I'd leave off that last backslash.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2022-12-10 02:50:09 | -Wunreachable-code-generic-assoc warnings on elver |
Previous Message | Tom Lane | 2022-12-10 01:28:47 | Re: Error-safe user functions |