]> git.saurik.com Git - bison.git/commitdiff
lalrl1.cc: give a chance to user defined YYLLOC_DEFAULT.
authorAkim Demaille <demaille@gostai.com>
Wed, 12 May 2010 09:12:24 +0000 (11:12 +0200)
committerAkim Demaille <demaille@gostai.com>
Wed, 12 May 2010 09:12:24 +0000 (11:12 +0200)
* data/lalr1.cc (YYLLOC_DEFAULT): Move its definition from the
header file to the implementation file, after the user %code
sections.
* NEWS: Document it.

Conflicts:

ChangeLog
data/lalr1.cc

ChangeLog
NEWS
data/lalr1.cc

index 7d8b96bedaf05f303106690d3dac176f67996f97..2b80e95b9eeb43b124518fde8a95282e8cb058dc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-05-11  Akim Demaille  <demaille@gostai.com>
+
+       lalrl1.cc: give a chance to user defined YYLLOC_DEFAULT.
+       * data/lalr1.cc (YYLLOC_DEFAULT): Move its definition from the
+       header file to the implementation file, after the user %code
+       sections.
+       * NEWS (2.5): Document this.
+
 2010-05-07  Akim Demaille  <demaille@gostai.com>
 
        c++: use YYRHSLOC.
diff --git a/NEWS b/NEWS
index ee269105210522fafe1fd36c8af6b9d417958e01..d890edbb495113bfcdd35ea43406bf49e8487258 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -215,6 +215,13 @@ Bison News
             }                                                              \
         while (false)
 
+** YYLLOC_DEFAULT in C++
+
+  The default implementation of YYLLOC_DEFAULT used to be issued in
+  the header file.  It is now output in the implementation file, after
+  the user %code sections so that its #ifndef guard does not try to
+  override the user's YYLLOC_DEFAULT if provided.
+
 * Changes in version 2.4.3 (????-??-??):
 
 ** Problems with spawning M4 on at least FreeBSD 8 and FreeBSD 9 have
index b400b310306db385f840b6fe14f000d59304c375..641a45cea483f3e00a4c36c5fce50e44910b60ac 100644 (file)
@@ -69,26 +69,6 @@ dnl FIXME: This is wrong, we want computed header guards.
 # define YYTOKEN_TABLE ]b4_token_table[
 #endif
 
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
-   If N is 0, then set CURRENT to the empty location which ends
-   the previous symbol: RHS[0] (always defined).  */
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N)                               \
- do                                                                    \
-   if (N)                                                              \
-     {                                                                 \
-       (Current).begin = YYRHSLOC (Rhs, 1).begin;                      \
-       (Current).end   = YYRHSLOC (Rhs, N).end;                        \
-     }                                                                 \
-   else                                                                \
-     {                                                                 \
-       (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end;        \
-     }                                                                 \
- while (false)
-#endif
-
 ]b4_namespace_open[
 
   /// A Bison parser.
@@ -331,6 +311,26 @@ b4_percent_code_get[]dnl
 # endif
 #endif
 
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+   If N is 0, then set CURRENT to the empty location which ends
+   the previous symbol: RHS[0] (always defined).  */
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N)                               \
+ do                                                                    \
+   if (N)                                                              \
+     {                                                                 \
+       (Current).begin = YYRHSLOC (Rhs, 1).begin;                      \
+       (Current).end   = YYRHSLOC (Rhs, N).end;                        \
+     }                                                                 \
+   else                                                                \
+     {                                                                 \
+       (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end;        \
+     }                                                                 \
+ while (false)
+#endif
+
 /* Suppress unused-variable warnings by "using" E.  */
 #define YYUSE(e) ((void) (e))