On Wed, Sep 21, 2016 at 1:03 PM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> Yeah but that's at run time. I meant you could help developers
> discover ASAP if they add a new item to one place but not the other
> with a compile time assertion:
> const char *
> GetWaitEventIdentifier(uint16 eventId)
> {
> StaticAssertStmt(lengthof(WaitEventNames) == WE_LAST_TYPE + 1,
> "WaitEventNames must match WaitEventIdentifiers");
> if (eventId > WE_LAST_TYPE)
> return "???";
> return WaitEventNames[eventId];
> }
Ah, OK, good idea. I had AssertStmt in mind, not StaticAssertStmt.
> You missed a couple that are hiding inside #ifdef WIN32:
>
> From pgstat.c:
> + EVENT_PGSTAT_MAIN);
>
> From syslogger.c:
> + EVENT_SYSLOGGER_MAIN);
Oops. Fixed those ones and checked the builds on WIN32.
--
Michael