From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9224 invoked by alias); 7 May 2010 15:31:17 -0000 Received: (qmail 9214 invoked by uid 22791); 7 May 2010 15:31:16 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.157) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 07 May 2010 15:31:11 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o47FV7j6007297 for ; Fri, 7 May 2010 17:31:08 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms1.u-strasbg.fr [IPv6:2001:660:2402:d::10]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id o47FV7cJ066291 for ; Fri, 7 May 2010 17:31:07 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from d620muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o47FV7Jw001006 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Fri, 7 May 2010 17:31:07 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: Subject: [RFC] pascal support sizeof (expression) Date: Fri, 07 May 2010 15:31:00 -0000 Message-ID: <004c01caedfa$50bef820$f23ce860$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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/msg00176.txt.bz2 The pascal parser only supports sizeof (type), whereas c allows sizeof (expression). sizeof (var) is also a valid construction inside a pascal source, thus I want to add it to the parser. Once more, I ask before committing because I am unsure about the ChangeLog entry: - How should I describe this lexical rule addition? - Is it correct to put it inside 'pascal_parse'? That is the name of the function in the generated file p-exp.c. Pierre Muller Pascal language support maintainer for GDB 2010-05-07 Pierre Muller * p-exp.y (pascal_parse): Add support for `sizeof (expression)'. Index: src/gdb/p-exp.y =================================================================== RCS file: /cvs/src/src/gdb/p-exp.y,v retrieving revision 1.49 diff -u -p -r1.49 p-exp.y --- src/gdb/p-exp.y 6 May 2010 00:08:44 -0000 1.49 +++ src/gdb/p-exp.y 6 May 2010 23:06:14 -0000 @@ -525,6 +525,9 @@ exp : SIZEOF '(' type ')' %prec UNARY write_exp_elt_opcode (OP_LONG); } ; +exp : SIZEOF '(' exp ')' %prec UNARY + { write_exp_elt_opcode (UNOP_SIZEOF); } + exp : STRING { /* C strings are converted into array constants with an explicit null byte added at the end. Thus