From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26385 invoked by alias); 10 May 2010 21:53:59 -0000 Received: (qmail 26375 invoked by uid 22791); 10 May 2010 21:53:59 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 10 May 2010 21:53:54 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 958932BABB6 for ; Mon, 10 May 2010 17:53:52 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id k6nLJQNoCXq3 for ; Mon, 10 May 2010 17:53:52 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 125DE2BABAD for ; Mon, 10 May 2010 17:53:52 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 27816F58F9; Mon, 10 May 2010 14:53:47 -0700 (PDT) Date: Mon, 10 May 2010 21:53:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: RFC: Add language parameter to all parse.c:parse_* functions Message-ID: <20100510215347.GI2957@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2010-05/txt/msg00236.txt.bz2 This is a followup to: http://www.sourceware.org/ml/gdb-patches/2010-05/msg00221.html I think we all agree that depending on the current_language global to determine which language parser to use is bad. As a first step, we need to add language parameter to the parse routines in parse.c. Here is how I will do this, if that's OK with everyone: I will add the new parameter, and then review each caller trying to determine if there is an obvious language we can use. Otherwise, I will use current_language as the parameter. Normally, this should at worst keep things as they are today (ie: the current_language gets used). But we would then stop relying on this global inside that unit. We can then try to reduce the number of uses of current_language wherever appropiate based on necessity (when one finds a bug or works on the code). Any objection? Also: We have various parse routines declared in other modules, most notably eval.c:parse_and_eval*. It's unclear whether they also need to be updated to take a language argument - each function probably needs to be reviewed individually. For instance "parse_and_eval" most likely need to take a language as an argument, but it's less clear for parse_and_eval_address (I think it would be better to, since an Ada user might write an address as 16#deadbeef#). I propose to deal with that as a separate patch. -- Joel