From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8735 invoked by alias); 15 Dec 2014 13:49:39 -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 8613 invoked by uid 89); 15 Dec 2014 13:49:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 15 Dec 2014 13:49:36 +0000 Received: from svr-orw-fem-03.mgc.mentorg.com ([147.34.97.39]) by relay1.mentorg.com with esmtp id 1Y0W1k-0003z9-Rc from Yao_Qi@mentor.com ; Mon, 15 Dec 2014 05:49:32 -0800 Received: from GreenOnly (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.3.181.6; Mon, 15 Dec 2014 05:49:31 -0800 From: Yao Qi To: Ulrich Weigand CC: Jan Kratochvil , Subject: Re: [PATCH v4 12/14] add linux_infcall_mmap References: <201412151241.sBFCfZex012704@d03av02.boulder.ibm.com> Date: Mon, 15 Dec 2014 13:49:00 -0000 In-Reply-To: <201412151241.sBFCfZex012704@d03av02.boulder.ibm.com> (Ulrich Weigand's message of "Mon, 15 Dec 2014 13:41:34 +0100") Message-ID: <87egs1t44k.fsf@codesourcery.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-12/txt/msg00387.txt.bz2 Ulrich Weigand writes: > /home/uweigand/dailybuild/spu-tc-2014-12-13/binutils-gdb-head/binutils-gd= b/gdb/linux-tdep.c: > In function 'linux_infcall_mmap': > /home/uweigand/dailybuild/spu-tc-2014-12-13/binutils-gdb-head/binutils-gd= b/gdb/linux-tdep.c:1945: > error: expected identifier before numeric constant > > on my RHEL 5 build system, presumably because ARG_MAX is defined=20 > (to a numeric constant) by a system header. > > Can we give those more distinctive names? I got the same problem. Patch below unblocks the build. --=20 Yao (=E9=BD=90=E5=B0=A7) From: Yao Qi Date: Mon, 15 Dec 2014 21:40:29 +0800 Subject: [PATCH] Replace ARG_MAX with ARG_LAST We define an enum ARG_MAX in linux_infcall_mmap, but it is conflict with macro ARG_MAX which is defined in /usr/include/linux/limits.h. This causes a build failure below, gdb/linux-tdep.c: In function 'linux_infcall_mmap': gdb/linux-tdep.c:1945:70: error: expected identifier before numeric consta= nt the enum in the pre-processed source becomes: enum { ARG_ADDR, ARG_LENGTH, ARG_PROT, ARG_FLAGS, ARG_FD, ARG_OFFSET, 131072 }; This patch is to replace ARG_MAX with ARG_LAST. gdb: 2014-12-15 Yao Qi * linux-tdep.c (linux_infcall_mmap): Replace ARG_MAX with ARG_LAST. --- gdb/linux-tdep.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 485f5ca..6b5e475 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -1942,9 +1942,9 @@ linux_infcall_mmap (CORE_ADDR size, unsigned prot) CORE_ADDR retval; enum { - ARG_ADDR, ARG_LENGTH, ARG_PROT, ARG_FLAGS, ARG_FD, ARG_OFFSET, ARG_M= AX + ARG_ADDR, ARG_LENGTH, ARG_PROT, ARG_FLAGS, ARG_FD, ARG_OFFSET, ARG_L= AST }; - struct value *arg[ARG_MAX]; + struct value *arg[ARG_LAST]; =20 arg[ARG_ADDR] =3D value_from_pointer (builtin_type (gdbarch)->builtin_da= ta_ptr, 0); @@ -1961,7 +1961,7 @@ linux_infcall_mmap (CORE_ADDR size, unsigned prot) arg[ARG_FD] =3D value_from_longest (builtin_type (gdbarch)->builtin_int,= -1); arg[ARG_OFFSET] =3D value_from_longest (builtin_type (gdbarch)->builtin_= int64, 0); - addr_val =3D call_function_by_hand (mmap_val, ARG_MAX, arg); + addr_val =3D call_function_by_hand (mmap_val, ARG_LAST, arg); retval =3D value_as_address (addr_val); if (retval =3D=3D (CORE_ADDR) -1) error (_("Failed inferior mmap call for %s bytes, errno is changed."), --=20 1.9.3