This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[pushed] addrmap: use gdb_static_assert for type size assertions
- From: "Sourceware to Gerrit sync (Code Review)" <gerrit at gnutoolchain-gerrit dot osci dot io>
- To: Simon Marchi <simon dot marchi at polymtl dot ca>, gdb-patches at sourceware dot org
- Cc: Tom Tromey <tromey at sourceware dot org>
- Date: Tue, 29 Oct 2019 17:52:07 -0400
- Subject: [pushed] addrmap: use gdb_static_assert for type size assertions
- Auto-submitted: auto-generated
- References: <gerrit.1572379822000.If089fc5d620a7168bdcdf967c6c4fecd6696b670@gnutoolchain-gerrit.osci.io>
- Reply-to: noreply at gnutoolchain-gerrit dot osci dot io, simon dot marchi at polymtl dot ca, tromey at sourceware dot org, gdb-patches at sourceware dot org
Sourceware to Gerrit sync has submitted this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/441
......................................................................
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
---
M gdb/ChangeLog
M gdb/addrmap.c
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fee6332..3942b86 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
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 @@
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 *));
-}
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: If089fc5d620a7168bdcdf967c6c4fecd6696b670
Gerrit-Change-Number: 441
Gerrit-PatchSet: 2
Gerrit-Owner: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: merged