]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
lex.c (rid_to_yy, RID_EXPORT): Make unique keyword.
authorNathan Sidwell <nathan@codesourcery.com>
Mon, 20 Nov 2000 16:13:47 +0000 (16:13 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Mon, 20 Nov 2000 16:13:47 +0000 (16:13 +0000)
cp:
* lex.c (rid_to_yy, RID_EXPORT): Make unique keyword.
* parse.y (extdef): Add EXPORT reduction.
* spew.c (yylex): Don't skip export here.
testsuite:
* g++.old-deja/g++.pt/export1.C: New test.

From-SVN: r37585

gcc/cp/ChangeLog
gcc/cp/lex.c
gcc/cp/parse.y
gcc/cp/spew.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.pt/export1.C [new file with mode: 0644]

index 7886ddca74ae17b4f8923930975d6da586cc9c72..3e6af41fbc5246b905f2ca1f214fc4e9a22d974e 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-20  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.
+
 2000-11-19  Mark Mitchell  <mark@codesourcery.com>
 
        * decl.c (init_decl_processing): Correct name of pure virtual
index df5dc94f39306797622bfbbc7673ad8c297f7cd4..b0553e0434f5b62024140f7b59f2ba270137d121 100644 (file)
@@ -544,7 +544,7 @@ const short rid_to_yy[RID_MAX] =
   /* RID_FRIEND */     SCSPEC,
   /* RID_VIRTUAL */    SCSPEC,
   /* RID_EXPLICIT */   SCSPEC,
-  /* RID_EXPORT */     SCSPEC,
+  /* RID_EXPORT */     EXPORT,
   /* RID_MUTABLE */    SCSPEC,
 
   /* ObjC */
index b8dff069e90c58bec505df82d93604c4374b68d9..13c678b7b2a61436882cf5fb135911805ac8b564 100644 (file)
@@ -278,7 +278,7 @@ cp_parse_init ()
 %token NAMESPACE TYPENAME_KEYWORD USING
 %token LEFT_RIGHT TEMPLATE
 %token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
-%token SCOPE
+%token SCOPE EXPORT
 
 /* Define the operator tokens and their precedences.
    The value is an integer because, if used, it is the tree code
@@ -485,6 +485,11 @@ extdef:
                { 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 9e6b65ba3b84780051756efb7f561a9cf2d7e28c..0894993a8b6b67d58ad059ceddd1bb5fdf0ce044 100644 (file)
@@ -803,17 +803,6 @@ yylex ()
              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;
index 2db948fa1e5472823581d7697e4b6e6c045d4bdb..efb25913a33cb04018fc9b170cd69151544cb42c 100644 (file)
@@ -1,3 +1,7 @@
+2000-11-20  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * g++.old-deja/g++.pt/export1.C: New test.
+
 2000-11-20  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc.dg/20001117-1.c: New test.
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/export1.C b/gcc/testsuite/g++.old-deja/g++.pt/export1.C
new file mode 100644 (file)
index 0000000..43f7973
--- /dev/null
@@ -0,0 +1,18 @@
+// Build don't link:
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 17 Nov 2000 <nathan@codesourcery.com>
+
+
+// bug 721, we died horribly when export was used wrongly
+
+struct test {
+int export(void);   // ERROR - parse error
+};
+
+int test::export(void) // ERROR - parse error
+{
+return 0;
+}
+
+template <class T> class Y;
+export template <class T> class X;  // WARNING - export not implemented