From patchwork Tue Oct 29 21:52:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 35453 Received: (qmail 37169 invoked by alias); 29 Oct 2019 21:52:14 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 37082 invoked by uid 89); 29 Oct 2019 21:52:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 29 Oct 2019 21:52:12 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id C017B21254; Tue, 29 Oct 2019 17:52:09 -0400 (EDT) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id 97B6020D63; Tue, 29 Oct 2019 17:52:07 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 8613C2A7D9; Tue, 29 Oct 2019 17:52:07 -0400 (EDT) X-Gerrit-PatchSet: 2 Date: Tue, 29 Oct 2019 17:52:07 -0400 From: "Sourceware to Gerrit sync (Code Review)" To: Simon Marchi , gdb-patches@sourceware.org Cc: Tom Tromey Auto-Submitted: auto-generated X-Gerrit-MessageType: merged Subject: [pushed] addrmap: use gdb_static_assert for type size assertions X-Gerrit-Change-Id: If089fc5d620a7168bdcdf967c6c4fecd6696b670 X-Gerrit-Change-Number: 441 X-Gerrit-ChangeURL: X-Gerrit-Commit: 90421c56566cca675aaece34a76b68af77dd76e6 In-Reply-To: References: Reply-To: noreply@gnutoolchain-gerrit.osci.io, simon.marchi@polymtl.ca, tromey@sourceware.org, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-74-g460fb0f7e9 Message-Id: <20191029215207.8613C2A7D9@gnutoolchain-gerrit.osci.io> 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 + + * addrmap.c: Add static assertions of type size, moved from + _initialize_addrmap. + (_initialize_addrmap): Remove. + 2019-10-29 Christian Biesinger * 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 *)); -}