RE: Proposal: Add more compile-time asserts to exposeinconsistencies. - Mailing list pgsql-hackers

From Smith, Peter
Subject RE: Proposal: Add more compile-time asserts to exposeinconsistencies.
Date
Msg-id 201DD0641B056142AC8C6645EC1B5F62014B9FB055@SYD1217
Whole thread Raw
In response to Re: Proposal: Add more compile-time asserts to exposeinconsistencies.  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Proposal: Add more compile-time asserts to exposeinconsistencies.  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
Hello Michael,

> In short, attached is an updated version of your patch which attempts to solve that.  I have tested this with some
cplusplusstuff, and GCC for both versions (static_assert is available in GCC >= 6, but a manual change of c.h does the
trick).
> I have edited the patch a bit while on it, your assertions did not use project-style grammar, the use of parenthesis
wasinconsistent (see relpath.c for example), and pgindent has complained a bit. 

Thanks for your updates.

~~

Hello Andres,

>> +StaticAssertDecl(lengthof(LockTagTypeNames) == (LOCKTAG_ADVISORY + 1),
>> +                 "LockTagTypeNames array inconsistency");
>> +
> These error messages strike me as somewhat unhelpful. I'd probably just reword them as "array length mismatch" or
somethinglike that. 

I updated the most recent patch (_5 from Michael) so it now has your suggested error message rewording.

PSA patch _6

Kind Regards
----
Peter Smith
Fujitsu Australia

Attachment

pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: [HACKERS] kqueue
Next
From: Tomas Vondra
Date:
Subject: Re: How is this possible "publication does not exist"