bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: lalr1.cc: YYSTYPE is a union, not a typedef


From: Akim Demaille
Subject: FYI: lalr1.cc: YYSTYPE is a union, not a typedef
Date: Tue, 23 Nov 2004 20:54:15 +0100

: ChangeLog
===================================================================
RCS file: /cvsroot/bison/bison/ChangeLog,v
retrieving revision 1.1160
diff -u -r1.1160 ChangeLog
--- ChangeLog   23 Nov 2004 08:50:37 -0000      1.1160
+++ ChangeLog   23 Nov 2004 19:55:16 -0000
@@ -1,3 +1,10 @@
+2004-11-23  Akim Demaille  <address@hidden>
+
+       * data/lalr1.cc (YYSTYPE): Define it as is done for C, instead
+       of #defining from yystype.
+       Don't typedef yystype, C++ does not need it.
+       This lets it possible to forward declare it as union.
+
 2004-11-23  Paul Eggert  <address@hidden>

        * bootstrap (gnulib_modules): Add extensions.
Index: data/lalr1.cc
===================================================================
RCS file: /cvsroot/bison/bison/data/lalr1.cc,v
retrieving revision 1.64
diff -u -r1.64 lalr1.cc
--- data/lalr1.cc       17 Nov 2004 16:48:45 -0000      1.64
+++ data/lalr1.cc       23 Nov 2004 19:55:17 -0000
@@ -164,16 +164,16 @@
 # define YYERROR_VERBOSE ]b4_error_verbose[
 #endif

-#ifdef YYSTYPE
-typedef YYSTYPE yystype;
-#else
+#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 ]m4_ifdef([b4_stype],
 [b4_syncline([b4_stype_line], [b4_filename])
-typedef union b4_stype yystype;
+union YYSTYPE b4_stype;
 /* Line __line__ of lalr1.cc.  */
 b4_syncline(address@hidden@], address@hidden@])],
-[typedef int yystype;])[
-# define YYSTYPE yystype
+[typedef int YYSTYPE;])[
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
 #endif

 /* Copy the second part of user declarations.  */
@@ -215,7 +215,7 @@
     typedef ]b4_int_type_for([b4_translate])[ TokenNumberType;
     typedef ]b4_int_type_for([b4_rhs])[       RhsNumberType;
     typedef int StateType;
-    typedef yystype SemanticType;
+    typedef YYSTYPE SemanticType;
     typedef ]b4_location_type[ LocationType;
   };
 }

Attachment: diffs.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]