Fix bug 721

Nathan Sidwell nathan@codesourcery.com
Mon Nov 20 08:13:00 GMT 2000


Hi,
this fixes bug 721 where we died horribly because the lexer
eats `export' tokens early.

built & tested on i686-pc-linux-gnu, approved by Mark

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2000-11-17  Nathan Sidwell  <nathan@codesourcery.com>

	* lex.c (rid_to_yy, RID_EXPORT): Make unique keyword.
	* parse.y (extdef): Add EXPORT reduction.
	* spew.c (yylex): Don't skip export here.

Index: cp/lex.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/lex.c,v
retrieving revision 1.224
diff -c -3 -p -r1.224 lex.c
*** lex.c	2000/11/17 06:05:29	1.224
--- lex.c	2000/11/17 15:08:12
*************** const short rid_to_yy[RID_MAX] =
*** 550,556 ****
    /* RID_FRIEND */	SCSPEC,
    /* RID_VIRTUAL */	SCSPEC,
    /* RID_EXPLICIT */	SCSPEC,
!   /* RID_EXPORT */	SCSPEC,
    /* RID_MUTABLE */	SCSPEC,
  
    /* ObjC */
--- 550,556 ----
    /* RID_FRIEND */	SCSPEC,
    /* RID_VIRTUAL */	SCSPEC,
    /* RID_EXPLICIT */	SCSPEC,
!   /* RID_EXPORT */	EXPORT,
    /* RID_MUTABLE */	SCSPEC,
  
    /* ObjC */
Index: cp/parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/parse.y,v
retrieving revision 1.199
diff -c -3 -p -r1.199 parse.y
*** parse.y	2000/11/09 09:55:32	1.199
--- parse.y	2000/11/17 15:08:12
*************** cp_parse_init ()
*** 278,284 ****
  %token NAMESPACE TYPENAME_KEYWORD USING
  %token LEFT_RIGHT TEMPLATE
  %token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
! %token SCOPE
  
  /* Define the operator tokens and their precedences.
     The value is an integer because, if used, it is the tree code
--- 278,284 ----
  %token NAMESPACE TYPENAME_KEYWORD USING
  %token LEFT_RIGHT TEMPLATE
  %token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
! %token SCOPE EXPORT
  
  /* Define the operator tokens and their precedences.
     The value is an integer because, if used, it is the tree code
*************** extdef:
*** 485,490 ****
--- 485,495 ----
  		{ do_pending_inlines (); }
  	| datadef
  		{ do_pending_inlines (); }
+ 
+ 	| EXPORT
+ 		{ cp_warning ("keyword `export' not implemented, and will be ignored"); }
+ 	  template_def
+ 		{ do_pending_inlines (); }
  	| template_def
  		{ do_pending_inlines (); }
  	| asm_keyword '(' string ')' ';'
Index: cp/spew.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/spew.c,v
retrieving revision 1.36
diff -c -3 -p -r1.36 spew.c
*** spew.c	2000/11/09 09:55:32	1.36
--- spew.c	2000/11/17 15:08:13
*************** yylex ()
*** 803,819 ****
  	      consume_token ();
  	    }
  	}
-       /* If export, warn that it's unimplemented and go on. */
-       else if (nth_token (0)->yylval.ttype == ridpointers[RID_EXPORT])
- 	{
- 	  warning ("keyword 'export' not implemented and will be ignored");
- #ifdef SPEW_DEBUG    
- 	  if (spew_debug)
- 	    debug_yychar (yychr);
- #endif
- 	  consume_token ();
- 	  goto retry;
- 	}
        /* do_aggr needs to know if the previous token was `friend'.  */
        else if (nth_token (0)->yylval.ttype == ridpointers[RID_FRIEND])
  	after_friend = 1;
--- 803,808 ----


More information about the Gcc-patches mailing list