]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
addrmap: use gdb_static_assert for type size assertions
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 29 Oct 2019 21:51:36 +0000 (17:51 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 29 Oct 2019 21:51:36 +0000 (17:51 -0400)
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

gdb/ChangeLog
gdb/addrmap.c

index fee6332e8fc3257c189b6a5745158a50fc977210..3942b867a938fd0c2202502b6379c1aee2b5bf6b 100644 (file)
@@ -1,3 +1,9 @@
+2019-10-29  Simon Marchi  <simon.marchi@efficios.com>
+
+       * addrmap.c: Add static assertions of type size, moved from
+       _initialize_addrmap.
+       (_initialize_addrmap): Remove.
+
 2019-10-29  Christian Biesinger  <cbiesinger@google.com>
 
        * coffread.c (record_minimal_symbol): Update.
index 6c3ed6945fbe49a811d297ac1950ab27d46172cc..bcdb4817042f413d99d275bf83b6172f2230164f 100644 (file)
 #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 *));
+
 \f
 /* 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 *));
-}