From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5774 invoked by alias); 7 Mar 2006 15:19:47 -0000 Received: (qmail 5748 invoked by uid 22791); 7 Mar 2006 15:19:46 -0000 X-Spam-Check-By: sourceware.org Received: from intranet.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.6) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 07 Mar 2006 15:19:46 +0000 Received: (qmail 8501 invoked from network); 7 Mar 2006 15:19:44 -0000 Received: from unknown (HELO 81-178-176-36.dsl.pipex.com) (paul@127.0.0.2) by mail.codesourcery.com with ESMTPA; 7 Mar 2006 15:19:44 -0000 From: Paul Brook To: "Mark Kettenis" Subject: Re: [patch] Avoid gcc specific compiler flags Date: Tue, 07 Mar 2006 17:46:00 -0000 User-Agent: KMail/1.9.1 Cc: gdb-patches@sourceware.org References: <200603061518.23469.paul@codesourcery.com> <200603071421.08416.paul@codesourcery.com> <22344.192.87.1.22.1141741508.squirrel@webmail.xs4all.nl> In-Reply-To: <22344.192.87.1.22.1141741508.squirrel@webmail.xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603071519.38581.paul@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-03/txt/msg00114.txt.bz2 > I was talking about the following fragment: > > + set nowarnings [lsearch -exact $options nowarnings] > + if {$nowarnings != -1} { > + if [target_info exists gdb,nowarnings_flag] { > + set flag "additional_flags=[target_info gdb,nowarnings_flag]" > + } else { > + set flag "additional_flags=-w" > + } > + set options [lreplace $options $nowarnings $nowarnings $flag] > > There's a double $nowarnings on that last line. or is that intentional? > In that case I don't understand this code completely, and it needs a > comment to explain it. That's deliberate. The code replaces the "nowarnings" option with additional_flags=[something] $nowarnings is the index of the nowarnings option in the list of options. The lreplace function replaces a range of list items. In this case we want to replace a single list element so the start and end of the range are the same. I've added the following comment and applied the patch. # Replace the "nowarnings" option with the appropriate additional_flags # to disable compiler warnings. Paul