Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] pascal support sizeof (expression)
@ 2010-05-07 15:31 Pierre Muller
  2010-05-07 16:11 ` Joel Brobecker
  0 siblings, 1 reply; 3+ messages in thread
From: Pierre Muller @ 2010-05-07 15:31 UTC (permalink / raw)
  To: gdb-patches

  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  <muller@ics.u-strasbg.fr>

	* 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] pascal support sizeof (expression)
  2010-05-07 15:31 [RFC] pascal support sizeof (expression) Pierre Muller
@ 2010-05-07 16:11 ` Joel Brobecker
  2010-05-08  9:20   ` Pierre Muller
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2010-05-07 16:11 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

>   Once more, I ask before committing because I am
> unsure about the ChangeLog entry:

When unsure, I tend to look at prior art ;-).

> Pierre Muller
> Pascal language support maintainer for GDB
> 
> 2010-05-07  Pierre Muller  <muller@ics.u-strasbg.fr>
> 
> 	* p-exp.y (pascal_parse): Add support for `sizeof (expression)'.

I usually tend to provide the name of the rule, like in makefiles...
Or looking at Tom's entry:

        (exp : VARIABLE): Call write_dollar_variable.

> 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

-- 
Joel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [RFC] pascal support sizeof (expression)
  2010-05-07 16:11 ` Joel Brobecker
@ 2010-05-08  9:20   ` Pierre Muller
  0 siblings, 0 replies; 3+ messages in thread
From: Pierre Muller @ 2010-05-08  9:20 UTC (permalink / raw)
  To: 'Joel Brobecker'; +Cc: gdb-patches

> >   Once more, I ask before committing because I am
> > unsure about the ChangeLog entry:
> 
> When unsure, I tend to look at prior art ;-).

  I did, but didn't find any obvious pattern...
 
> > Pierre Muller
> > Pascal language support maintainer for GDB
> >
> > 2010-05-07  Pierre Muller  <muller@ics.u-strasbg.fr>
> >
> > 	* p-exp.y (pascal_parse): Add support for `sizeof (expression)'.
> 
> I usually tend to provide the name of the rule, like in makefiles...
> Or looking at Tom's entry:
> 
>         (exp : VARIABLE): Call write_dollar_variable.

I committed the patch with this ChangeLog entry:

2010-05-08  Pierre Muller  <muller@ics.u-strasbg.fr>

       * p-exp.y (exp : SIZEOF '(' exp ')'): New rule.


Pierre


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-08  9:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-07 15:31 [RFC] pascal support sizeof (expression) Pierre Muller
2010-05-07 16:11 ` Joel Brobecker
2010-05-08  9:20   ` Pierre Muller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox