diff options
Diffstat (limited to 'gdb/common/gdb_assert.h')
-rw-r--r-- | gdb/common/gdb_assert.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/common/gdb_assert.h b/gdb/common/gdb_assert.h index 634049e..de1a1c9 100644 --- a/gdb/common/gdb_assert.h +++ b/gdb/common/gdb_assert.h @@ -20,6 +20,12 @@ #ifndef GDB_ASSERT_H #define GDB_ASSERT_H +/* A static assertion. This will cause a compile-time error if EXPR, + which must be a compile-time constant, is false. */ + +#define static_assert(expr) \ + extern int never_defined_just_used_for_checking[(expr) ? 1 : -1] + /* PRAGMATICS: "gdb_assert.h":gdb_assert() is a lower case (rather than upper case) macro since that provides the closest fit to the existing lower case macro <assert.h>:assert() that it is |