From: | "Smith, Peter" <peters(at)fast(dot)au(dot)fujitsu(dot)com> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Michael Paquier" <michael(at)paquier(dot)xyz>, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | RE: Proposal: Add more compile-time asserts to expose inconsistencies. |
Date: | 2019-11-27 11:50:26 |
Message-ID: | 201DD0641B056142AC8C6645EC1B5F62014B9C2619@SYD1217 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Andres,
>>> As far as I can tell we should be able to use the prototype based approach in all the cases where we currently use the "negative bit-field width" approach?
>> ...
>> But I did not refactor existing code to use the new way because I was
>> fearful that there might be some subtle reason why the
>> StaticAssertStmt was deliberately made that way (e.g. as do/while),
>> and last thing I want to do was break working code.
>That'll just leave us with cruft. And it's not like this stuff will break in a subtle way or such....
FYI - I did try, per your suggestion, to replace the existing StaticAssertStmt to also use the same fallback "extern" syntax form as the new StaticAssertDecl, but the code broke as I suspected it might do:
====================
path.c: In function 'first_dir_separator':
../../src/include/c.h:847:2: error: expected expression before 'extern'
extern void static_assert_func(int static_assert_failure[(condition) ? 1 : -1])
^
../../src/include/c.h:849:2: note: in expansion of macro 'StaticAssertStmt'
StaticAssertStmt(condition, errmessage)
^
../../src/include/c.h:1184:3: note: in expansion of macro 'StaticAssertExpr'
(StaticAssertExpr(__builtin_types_compatible_p(__typeof(expr), const underlying_type), \
^
path.c:127:11: note: in expansion of macro 'unconstify'
return unconstify(char *, p);
^
====================
Kind Regards.
---
Peter Smith
Fujitsu Australia
From | Date | Subject | |
---|---|---|---|
Next Message | LIANGBO | 2019-11-27 11:52:48 | [Incident report]Backend process crashed when executing 2pc transaction |
Previous Message | Konstantin Knizhnik | 2019-11-27 11:33:42 | How to prohibit parallel scan through tableam? |