From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9724 invoked by alias); 2 May 2012 16:41:01 -0000 Received: (qmail 9706 invoked by uid 22791); 2 May 2012 16:40:59 -0000 X-SWARE-Spam-Status: No, hits=-5.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-vb0-f41.google.com (HELO mail-vb0-f41.google.com) (209.85.212.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 May 2012 16:40:46 +0000 Received: by vbbey12 with SMTP id ey12so762856vbb.0 for ; Wed, 02 May 2012 09:40:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding:x-system-of-record :x-gm-message-state; bh=syHgsLdStXI9oHbcLjGD1pV48V120prMnFQdmXOKIhI=; b=oMYqoZQEzuCvYsJQek7+EiM/wMfGOj4lzdebTPz2uvOOXf09g2y85UicjmpEvrbiD4 +HdIOM4+g7y+ZRzhH4tYXbBLye8S0uxQztg9D+lihlw+02o9s+PRV2k9UTFwacwL36gU hWXm1ho3ucc5JcUO/BR6dAGtYlmKC4+gvgUhV9umqddHSULuL8Ib9me0amEEKCdlvyD1 ymiBjLTkVX63VmngiodiX252CnmnBG/vEVW/AuS6O0cB16MP9zUI9BKHsDJX9cWixjb8 4Yf16Gn255B2Kh87ho1s1J9jQdDZeRdBj0m3Lj/yqPNiPOqObHvyMoe9AFPshgCQuKIq eOjQ== Received: by 10.52.65.69 with SMTP id v5mr13142383vds.14.1335976845601; Wed, 02 May 2012 09:40:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.65.69 with SMTP id v5mr13142373vds.14.1335976845513; Wed, 02 May 2012 09:40:45 -0700 (PDT) Received: by 10.52.165.2 with HTTP; Wed, 2 May 2012 09:40:45 -0700 (PDT) In-Reply-To: <05ADE46C-9093-4EE4-92A7-1232779DE5DC@adacore.com> References: <8781499A-A489-42D0-80B1-75136331DBDB@adacore.com> <87mx5x40uz.fsf@fleche.redhat.com> <05ADE46C-9093-4EE4-92A7-1232779DE5DC@adacore.com> Date: Wed, 02 May 2012 16:41:00 -0000 Message-ID: Subject: Re: [RFA] Emit a warning for ineffective set VAR = EXP command From: Doug Evans To: Tristan Gingold Cc: Tom Tromey , "gdb-patches@sourceware.org ml" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-Gm-Message-State: ALoCoQkEyXaFvVhn/QJqeMtWXabPUlPs84KdebPCunkjYiKbjMsGLO0nBAfoVqcQVg76Eqqg7v7vZp5nPvnRNjHWZp+PhZRvMitwq7WP08gdCUlweP2QHb4BeQCbMS/G9V6W/noWRXN/c/Xyesuly/FpglvJAl1z1Q== 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-05/txt/msg00021.txt.bz2 I think the convention now is to use prepare_for_testing to simplify a lot of the setup in the .exp file. Grep for other uses to see how it's used. On Wed, May 2, 2012 at 6:17 AM, Tristan Gingold wrote: > > On Apr 27, 2012, at 6:04 PM, Tom Tromey wrote: > >>>>>>> "Tristan" =3D=3D Tristan Gingold writes: >> >> Tristan> I simply propose to emit a warning if the expression is not an >> Tristan> assignment (or a comma expression). >> >> It seems reasonable to me. >> >> Tristan> Ok for trunk ? >> >> I think there should be a test case. > > Sure. =A0Is it ok with this testcase ? > > Tristan. > > gdb/testsuite/ > 2012-05-02 =A0Tristan Gingold =A0 > > =A0 =A0 =A0 =A0* gdb.base/set-noassign.exp: New test. > > diff --git a/gdb/testsuite/gdb.base/set-noassign.exp b/gdb/testsuite/gdb.= base/set-noassign.exp > new file mode 100644 > index 0000000..d43bfbe > --- /dev/null > +++ b/gdb/testsuite/gdb.base/set-noassign.exp > @@ -0,0 +1,41 @@ > +# Copyright 2012 Free Software Foundation, Inc. > + > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =A0See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. =A0If not, see . > + > + > +set testfile start > +set srcfile ${testfile}.c > +set binfile ${objdir}/${subdir}/${testfile} > +if =A0{ [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" execu= table {debug}] !=3D "" } { > + =A0 =A0untested "Couldn't compile test program" > + =A0 =A0return -1 > +} > + > +# Get things started. > + > +gdb_exit > +gdb_start > +gdb_reinitialize_dir $srcdir/$subdir > +gdb_load ${binfile} > + > +if ![runto_main] then { > + =A0 =A0fail "Can't run to main" > + =A0 =A0return 0 > +} > + > +# Verify that set command without assignment emits a warning. > +# > +gdb_test "set x=3D=3D3" \ > + =A0 =A0 =A0 "warning: Expression is not an assignment \\(and might have= no effect\\)" \ > + =A0 =A0 =A0 "warning for set without assignment" >