From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 94540 invoked by alias); 5 Apr 2017 13:50:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 93874 invoked by uid 89); 5 Apr 2017 13:50:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No 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,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Apr 2017 13:50:35 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DBD09AD17; Wed, 5 Apr 2017 13:50:34 +0000 (UTC) From: Andreas Schwab To: Alan Hayward Cc: Yao Qi , "gdb-patches\@sourceware.org" , nd Subject: Re: [PATCH 7/11] Add BFIN_MAX_REGISTER_SIZE References: <86tw63p2rx.fsf@gmail.com> X-Yow: I'll show you MY telex number if you show me YOURS... Date: Wed, 05 Apr 2017 13:50:00 -0000 In-Reply-To: (Alan Hayward's message of "Wed, 5 Apr 2017 13:43:50 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2017-04/txt/msg00104.txt.bz2 On Apr 05 2017, Alan Hayward wrote: >> On 5 Apr 2017, at 11:28, Yao Qi wrote: >> >> Alan Hayward writes: >> >>> diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c >>> index 3df1ba387a323dc6827b1189432f8877d1833184..9b45633cab15b8e0adb0d51a2fa650dc2bc6339b 100644 >>> --- a/gdb/bfin-tdep.c >>> +++ b/gdb/bfin-tdep.c >>> @@ -689,7 +689,7 @@ static enum register_status >>> bfin_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, >>> int regnum, gdb_byte *buffer) >>> { >>> - gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE); >>> + gdb_byte *buf = (gdb_byte *) alloca (BFIN_MAX_REGISTER_SIZE); >> >> Why don't you do "gdb_byte buf[4];"? It is only for CC register which >> is 32-bit. >> > > Is it not clearer code to add and use a macro rather than a magic number ? > > It’s also not obvious anywhere that the astat register is 32bits. I had to go > digging inside regformats/reg-bfin.dat before I found it out. > > Given that BFIN_MAX_REGISTER_SIZE is also 4, it compiles to the same size anyway. Since BFIN_MAX_REGISTER_SIZE is a constant you don't need alloca either way. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."