aboutsummaryrefslogtreecommitdiff
path: root/gdb/common/gdb_assert.h
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-11-22 21:18:38 +0000
committerTom Tromey <tromey@redhat.com>2011-11-22 21:18:38 +0000
commitf5afdc187dae0c7472d001381b579348b5d36316 (patch)
tree35b11836bce8a2e5e9cb56a255464ca80cd79c03 /gdb/common/gdb_assert.h
parentfc87b9e82571ba0015d5d3802cf714ae7c666ee6 (diff)
downloadgdb-f5afdc187dae0c7472d001381b579348b5d36316.zip
gdb-f5afdc187dae0c7472d001381b579348b5d36316.tar.gz
gdb-f5afdc187dae0c7472d001381b579348b5d36316.tar.bz2
* mi/mi-common.c (_initialize_gdb_mi_common): Remove.
Use static_assert to check the size of async_reason_string_lookup. * common/gdb_assert.h (static_assert): New macro.
Diffstat (limited to 'gdb/common/gdb_assert.h')
-rw-r--r--gdb/common/gdb_assert.h6
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