postgresql/contrib/hstore
Tom Lane 0d0aa5d291 Provide some static-assertion functionality on all compilers.
On reflection (especially after noticing how many buildfarm critters have
__builtin_types_compatible_p but not _Static_assert), it seems like we
ought to try a bit harder to make these macros do something everywhere.
The initial cut at it would have been no help to code that is compiled only
on platforms without _Static_assert, for instance; and in any case not all
our contributors do their initial coding on the latest gcc version.

Some googling about static assertions turns up quite a bit of prior art
for making it work in compilers that lack _Static_assert.  The method
that seems closest to our needs involves defining a struct with a bit-field
that has negative width if the assertion condition fails.  There seems no
reliable way to get the error message string to be output, but throwing a
compile error with a confusing message is better than missing the problem
altogether.

In the same spirit, if we don't have __builtin_types_compatible_p we can at
least insist that the variable have the same width as the type.  This won't
catch errors such as "wrong pointer type", but it's far better than
nothing.

In addition to changing the macro definitions, adjust a
compile-time-constant Assert in contrib/hstore to use StaticAssertStmt,
so we can get some buildfarm coverage on whether that macro behaves sanely
or not.  There's surely more places that could be converted, but this is
the first one I came across.
2012-09-30 22:46:29 -04:00
..
data
expected Preserve column names in the execution-time tupledesc for a RowExpr. 2012-02-14 17:34:56 -05:00
sql Fix hstore regression tests. 2011-11-08 08:09:10 -05:00
.gitignore Support "make check" in contrib 2011-04-25 22:27:11 +03:00
crc32.c
crc32.h
hstore_compat.c Provide some static-assertion functionality on all compilers. 2012-09-30 22:46:29 -04:00
hstore_gin.c pgindent run before PG 9.1 beta 1. 2011-04-10 11:42:00 -04:00
hstore_gist.c Replace int2/int4 in C code with int16/int32 2012-06-25 01:51:46 +03:00
hstore_io.c Split tuple struct defs from htup.h to htup_details.h 2012-08-30 16:52:35 -04:00
hstore_op.c Split tuple struct defs from htup.h to htup_details.h 2012-08-30 16:52:35 -04:00
hstore--1.0--1.1.sql Fix hstore regression tests. 2011-11-08 08:09:10 -05:00
hstore--1.1.sql Remove hstore's text => text operator. 2011-11-07 21:47:45 -05:00
hstore--unpackaged--1.0.sql Throw a useful error message if an extension script file is fed to psql. 2011-10-12 15:45:03 -04:00
hstore.control Remove hstore's text => text operator. 2011-11-07 21:47:45 -05:00
hstore.h Replace int2/int4 in C code with int16/int32 2012-06-25 01:51:46 +03:00
Makefile Don't install hstore--1.0.sql any more. 2012-02-22 20:37:13 -05:00