[RFC] pascal support sizeof (expression)

Pierre Muller pierre.muller@ics-cnrs.unistra.fr
Fri May 7 15:31:00 GMT 2010


  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



More information about the Gdb-patches mailing list