From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7736 invoked by alias); 2 May 2012 13:17:44 -0000 Received: (qmail 7720 invoked by uid 22791); 2 May 2012 13:17:43 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED 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; Wed, 02 May 2012 13:17:27 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 5745E290046; Wed, 2 May 2012 15:17:32 +0200 (CEST) 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 Ki4G-IjA-rNG; Wed, 2 May 2012 15:17:32 +0200 (CEST) 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 441DC290044; Wed, 2 May 2012 15:17:32 +0200 (CEST) Subject: Re: [RFA] Emit a warning for ineffective set VAR = EXP command Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=us-ascii From: Tristan Gingold In-Reply-To: <87mx5x40uz.fsf@fleche.redhat.com> Date: Wed, 02 May 2012 13:17:00 -0000 Cc: "gdb-patches\@sourceware.org ml" Content-Transfer-Encoding: quoted-printable Message-Id: <05ADE46C-9093-4EE4-92A7-1232779DE5DC@adacore.com> References: <8781499A-A489-42D0-80B1-75136331DBDB@adacore.com> <87mx5x40uz.fsf@fleche.redhat.com> To: Tom Tromey 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/msg00018.txt.bz2 On Apr 27, 2012, at 6:04 PM, Tom Tromey wrote: >>>>>> "Tristan" =3D=3D Tristan Gingold writes: >=20 > Tristan> I simply propose to emit a warning if the expression is not an > Tristan> assignment (or a comma expression). >=20 > It seems reasonable to me. >=20 > Tristan> Ok for trunk ? >=20 > I think there should be a test case. Sure. Is it ok with this testcase ? Tristan. gdb/testsuite/ 2012-05-02 Tristan Gingold * gdb.base/set-noassign.exp: New test. diff --git a/gdb/testsuite/gdb.base/set-noassign.exp b/gdb/testsuite/gdb.ba= se/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. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set testfile start +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executabl= e {debug}] !=3D "" } { + untested "Couldn't compile test program" + return -1 +} + +# Get things started. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if ![runto_main] then { + fail "Can't run to main" + return 0 +} + +# Verify that set command without assignment emits a warning. +# +gdb_test "set x=3D=3D3" \ + "warning: Expression is not an assignment \\(and might have no effect\\)"= \ + "warning for set without assignment"