diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2019-10-29 17:51:36 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2019-10-29 17:51:36 -0400 |
commit | 90421c56566cca675aaece34a76b68af77dd76e6 (patch) | |
tree | fd32978ae833f4b49d3b8dd6450fd1a5280f12c8 /gdb/addrmap.c | |
parent | 31edb802957b0073c571f48b9262e66b817fd360 (diff) | |
download | gdb-90421c56566cca675aaece34a76b68af77dd76e6.zip gdb-90421c56566cca675aaece34a76b68af77dd76e6.tar.gz gdb-90421c56566cca675aaece34a76b68af77dd76e6.tar.bz2 |
addrmap: use gdb_static_assert for type size assertions
These assertions can be done at compile time instead of at runtime.
gdb/ChangeLog:
* addrmap.c: Add static assertions of type size, moved from
_initialize_addrmap.
(_initialize_addrmap): Remove.
Change-Id: If089fc5d620a7168bdcdf967c6c4fecd6696b670
Diffstat (limited to 'gdb/addrmap.c')
-rw-r--r-- | gdb/addrmap.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/gdb/addrmap.c b/gdb/addrmap.c index 6c3ed69..bcdb481 100644 --- a/gdb/addrmap.c +++ b/gdb/addrmap.c @@ -22,6 +22,11 @@ #include "gdb_obstack.h" #include "addrmap.h" +/* Make sure splay trees can actually hold the values we want to + store in them. */ +gdb_static_assert (sizeof (splay_tree_key) >= sizeof (CORE_ADDR *)); +gdb_static_assert (sizeof (splay_tree_value) >= sizeof (void *)); + /* The "abstract class". */ @@ -587,14 +592,3 @@ addrmap_create_mutable (struct obstack *obstack) return (struct addrmap *) map; } - -/* Initialization. */ - -void -_initialize_addrmap (void) -{ - /* Make sure splay trees can actually hold the values we want to - store in them. */ - gdb_assert (sizeof (splay_tree_key) >= sizeof (CORE_ADDR *)); - gdb_assert (sizeof (splay_tree_value) >= sizeof (void *)); -} |