Re: Proposal: Add more compile-time asserts to expose inconsistencies.

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: "Smith, Peter" <peters@fast.au.fujitsu.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>, "andres@anarazel.de" <andres@anarazel.de>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>, "peter.eisentraut@2ndquadrant.com" <peter.eisentraut@2ndquadrant.com>, "tgl@sss.pgh.pa.us" <tgl@sss.pgh.pa.us>, "ilmari@ilmari.org" <ilmari@ilmari.org>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2019-11-12T05:41:35Z
Lists: pgsql-hackers
On Mon, Oct 28, 2019 at 03:42:02AM +0000, Smith, Peter wrote:
> From: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Sent: Monday, 28 October 2019 1:26 PM
>> It is missing the __cplusplus case?
> 
> My use cases for the macro are only in C code, so that's all I was interested in at this time.
> If somebody else wants to extend the patch for C++ also (and test it) they can do.

It seems to me that there is a good point to be consistent with the
treatment of StaticAssertStmt and StaticAssertExpr in c.h, which have
fallback implementations in *all* the configurations supported.

@@ -858,7 +863,6 @@ extern void ExceptionalCondition(const char
*conditionName,
 #endif
 #endif                         /* C++ */

-
 /*
A nit: noise diffs.  (No need to send a new version just for that.)
--
Michael

Commits

  1. Add declaration-level assertions for compile-time checks

  2. Add support for static assertions in C++