From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14308 invoked by alias); 24 Feb 2012 13:48:58 -0000 Received: (qmail 14300 invoked by uid 22791); 24 Feb 2012 13:48:57 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 24 Feb 2012 13:48:39 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id B48B029004B; Fri, 24 Feb 2012 14:48:39 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OISiF3FA-yVm; Fri, 24 Feb 2012 14:48:39 +0100 (CET) Received: from ulanbator.act-europe.fr (ulanbator.act-europe.fr [10.10.1.67]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id A281C29002F; Fri, 24 Feb 2012 14:48:39 +0100 (CET) Subject: Re: patch in ada-tasks needs small fix (was: "New ARI warning Fri Feb 24 01:54:10 UTC 2012") Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=us-ascii From: Tristan Gingold In-Reply-To: <20120224134032.GJ2692@adacore.com> Date: Fri, 24 Feb 2012 13:56:00 -0000 Cc: gdb-patches@sourceware.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20120224015410.GA23561@sourceware.org> <20120224134032.GJ2692@adacore.com> To: Joel Brobecker X-IsSubscribed: yes 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 X-SW-Source: 2012-02/txt/msg00558.txt.bz2 On Feb 24, 2012, at 2:40 PM, Joel Brobecker wrote: > Hi Tristan, >=20 > On Fri, Feb 24, 2012 at 01:54:10AM +0000, GDB Administrator wrote: >> 5a6 >>> gdb/ada-tasks.c:881: code: if assignment: An IF statement's expression = contains an assignment (the GNU coding standard discourages this) >> gdb/ada-tasks.c:881: if (TYPE_CODE (type) =3D=3D TYPE_CODE_ARRAY = && (eltype =3D check_typedef (TYPE_TARGET_TYPE (type))) && TYPE_CODE= (eltype) =3D=3D TYPE_CODE_PTR && (idxtype =3D check_typedef (TYPE_IN= DEX_TYPE (type))) && !TYPE_LOW_BOUND_UNDEFINED (idxtype) && !TY= PE_HIGH_BOUND_UNDEFINED (idxtype)) >=20 > This one is for us. I confess I hadn't noticed the assignments in > the condition, but they are indeed. I think we can rewrite the code > relatively easily without too much change in the program structure. Ah, I missed this rule. > Would you take a look at that? If you don't get to it today, then > I will try to have a look at it. I can propose this patch, but I haven't yet tested it beyond compiling gdb: diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 4c0b667..11ad262 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -870,13 +870,15 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inf= erior_data *data) { /* Validate. */ struct type *type =3D check_typedef (SYMBOL_TYPE (sym)); - struct type *eltype; - struct type *idxtype; - - if (TYPE_CODE (type) =3D=3D TYPE_CODE_ARRAY - && (eltype =3D check_typedef (TYPE_TARGET_TYPE (type))) - && TYPE_CODE (eltype) =3D=3D TYPE_CODE_PTR - && (idxtype =3D check_typedef (TYPE_INDEX_TYPE (type))) + struct type *eltype =3D NULL; + struct type *idxtype =3D NULL; + + if (TYPE_CODE (type) =3D=3D TYPE_CODE_ARRAY) + eltype =3D check_typedef (TYPE_TARGET_TYPE (type)); + if (eltype !=3D NULL + && TYPE_CODE (eltype) =3D=3D TYPE_CODE_PTR) + idxtype =3D check_typedef (TYPE_INDEX_TYPE (type)); + if (idxtype !=3D NULL && !TYPE_LOW_BOUND_UNDEFINED (idxtype) && !TYPE_HIGH_BOUND_UNDEFINED (idxtype)) { What kind of testing do you want ? Tristan.