mirror of
https://github.com/NationalSecurityAgency/lemongraph.git
synced 2026-11-09 17:35:25 -10:00
return errors more consistently in db shim updated interfaces to <foo>_init and <foo>_new in db shim switched to stack allocation for short lived cursors inlined a bunch of functions
26 lines
862 B
C
26 lines
862 B
C
#ifndef _STATIC_ASSERT_H
|
|
#define _STATIC_ASSERT_H
|
|
|
|
/*
|
|
* From: http://www.pixelbeat.org/programming/gcc/static_assert.html
|
|
* License: GNU All-Permissive License
|
|
* Date: October 2017
|
|
*/
|
|
|
|
#define ASSERT_CONCAT_(a, b) a##b
|
|
#define ASSERT_CONCAT(a, b) ASSERT_CONCAT_(a, b)
|
|
/* These can't be used after statements in c89. */
|
|
#ifdef __COUNTER__
|
|
#define STATIC_ASSERT(e,m) \
|
|
;enum { ASSERT_CONCAT(static_assert_, __COUNTER__) = 1/(int)(!!(e)) }
|
|
#else
|
|
/* This can't be used twice on the same line so ensure if using in headers
|
|
* that the headers are not included twice (by wrapping in #ifndef...#endif)
|
|
* Note it doesn't cause an issue when used on same line of separate modules
|
|
* compiled with gcc -combine -fwhole-program. */
|
|
#define STATIC_ASSERT(e,m) \
|
|
;enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(int)(!!(e)) }
|
|
#endif
|
|
|
|
#endif
|