]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/lexer.ll (avoid_silly_flex_induced_gcc_warnings): Disable.
authorJan Nieuwenhuizen <janneke@gnu.org>
Sun, 13 Apr 2003 11:48:48 +0000 (11:48 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sun, 13 Apr 2003 11:48:48 +0000 (11:48 +0000)
* lily/includable-lexer.cc [!HAVE_FLEXLEXER_YY_CURRENT_BUFFER]
(yy_current_buffer): New macro, compile hacks for flex 2.5.29.

* lily/include/includable-lexer.hh:
* lily/lexer.ll: Hack for multiple include of FlexLexer.h.

* config.hh.in (HAVE_FLEXLEXER_YY_CURRENT_BUFFER): Add.

* aclocal.m4: Regenerate.

* stepmake/aclocal.m4 (STEPMAKE_FLEXLEXER): Check for
yyFlexLexer.yy_current_buffer, which was removed in flex-2.5.29.

ChangeLog
aclocal.m4
config.hh.in
lily/includable-lexer.cc
lily/include/includable-lexer.hh
lily/include/my-lily-lexer.hh
lily/lexer.ll
stepmake/aclocal.m4

index 9540db5ead26a7bbf372e1db19e3802e00cb70f2..81c32e13f6e74bf2cc5f96641fe790e0e128f92f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2003-04-13  Jan Nieuwenhuizen  <janneke@gnu.org>
 
+       * flex-2.5.31 hits Debian/unstable.  Fixes below.
+       
+       * lily/lexer.ll (avoid_silly_flex_induced_gcc_warnings): Disable.
+
+       * lily/includable-lexer.cc [!HAVE_FLEXLEXER_YY_CURRENT_BUFFER]
+       (yy_current_buffer): New macro, compile hacks for flex 2.5.29.
+
+       * lily/include/includable-lexer.hh: 
+       * lily/lexer.ll: Hack for multiple include of FlexLexer.h.
+
+       * config.hh.in (HAVE_FLEXLEXER_YY_CURRENT_BUFFER): Add.
+
+       * aclocal.m4: Regenerate.
+
+       * stepmake/aclocal.m4 (STEPMAKE_FLEXLEXER): Check for
+       yyFlexLexer.yy_current_buffer, which was removed in flex-2.5.29.
+
        * scm/pdf.scm (use-modules): Include lily.
 
        * scm/pdftex.scm (start-system): Bugfix: add closing brace (Beernd
index 6acd560cef1d42e3980f73049d1f3b8c3f152c32..f72cb501a7b503f7cc70f3bfe55163614ba1ec95 100644 (file)
@@ -1,6 +1,6 @@
 dnl aclocal.m4   -*-shell-script-*-
 dnl WARNING WARNING WARNING
-dnl do not edit! this is aclocal.m4, generated from /users/hanwen/usr/src/lilypond/stepmake/aclocal.m4
+dnl do not edit! this is aclocal.m4, generated from /home/janneke/lily/stepmake/aclocal.m4
 dnl aclocal.m4   -*-shell-script-*-
 dnl StepMake subroutines for configure.in
 
@@ -334,6 +334,28 @@ AC_DEFUN(STEPMAKE_FLEXLEXER, [
        warn='FlexLexer.h (flex package)'
        STEPMAKE_ADD_ENTRY($1, $warn)
     fi
+    # check for yyFlexLexer.yy_current_buffer,
+    # in 2.5.4 <= flex < 2.5.29
+    AC_LANG_PUSH(C++)
+    AC_CACHE_CHECK([for yyFlexLexer.yy_current_buffer],
+       [stepmake_flexlexer_yy_current_buffer],
+       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <FlexLexer.h>
+class yy_flex_lexer: public yyFlexLexer
+{
+  public:
+    yy_flex_lexer ()
+    {
+      yy_current_buffer = 0;
+    }
+};
+]])],
+           [stepmake_flexlexer_yy_current_buffer=yes],
+           [stepmake_flexlexer_yy_current_buffer=no]))
+    if test $stepmake_flexlexer_yy_current_buffer = yes; then
+       AC_DEFINE(HAVE_FLEXLEXER_YY_CURRENT_BUFFER, 1, [Define to 1 if yyFlexLexer has yy_current_buffer.])
+    fi
+    AC_LANG_POP(C++)
 ])
 
 
index 5e276610b977510860771d606364dc6ca1f553d4..71848269c4aa1313f46065b0a58ea6b76c99abf2 100644 (file)
@@ -27,6 +27,9 @@
 /* define if you have vsnprintf */
 #define HAVE_VSNPRINTF 0
 
+/* define if you have yyFlexLexer.yy_current_buffer */
+#undef HAVE_FLEXLEXER_YY_CURRENT_BUFFER
+
 /* define if you have gettext */
 #define HAVE_GETTEXT 0
 
index 6d5207a084b33289766b7d557e537c91ac368f6d..e22180aad514a6828851a67671c0236d491dfc79 100644 (file)
 #define YYSTATE YY_START
 #endif
 
+/* Flex >= 2.5.29 has include stack; but we don't use that yet.  */
+#ifndef HAVE_FLEXLEXER_YY_CURRENT_BUFFER
+#define yy_current_buffer \
+  (yy_buffer_stack != 0 ? yy_buffer_stack[yy_buffer_stack_top] : 0)
+#endif
+
 Includable_lexer::Includable_lexer ()
 {
+#ifdef HAVE_FLEXLEXER_YY_CURRENT_BUFFER
   yy_current_buffer = 0;
+#endif
   allow_includes_b_ = true;
 }
 
@@ -106,10 +114,14 @@ Includable_lexer::close_input ()
   if (verbose_global_b)
     progress_indication ("]");
   yy_delete_buffer (yy_current_buffer);
+#ifdef HAVE_FLEXLEXER_YY_CURRENT_BUFFER  
   yy_current_buffer = 0;
+#endif  
   if (state_stack_.empty ())
     {
+#ifdef HAVE_FLEXLEXER_YY_CURRENT_BUFFER  
       yy_current_buffer = 0;
+#endif  
       return false;
     }
   else
index a05d707b0d41e74b850f7cc8f229032c6102b919..2406c259bb8819f8b089ad4f05694de7ea86ebdd 100644 (file)
@@ -6,12 +6,13 @@
   (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-
 #ifndef INCLUDABLE_LEXER_HH
 #define INCLUDABLE_LEXER_HH
 
+#ifndef LEXER_CC
 using namespace std;
 #include <FlexLexer.h>
+#endif
 
 #include "string.hh"
 #include "parray.hh"
index 27b98cda648a265a85992386eaf799a7b82468ca..123cf747049cd99eb1f3c0559cc3de526eb8a32a 100644 (file)
@@ -9,8 +9,7 @@
 #ifndef LEXER_HH
 #define LEXER_HH
 
-using namespace std;
-#include <FlexLexer.h>
+#include "includable-lexer.hh"
 
 #include "input.hh"
 #include "dictionary.hh"
@@ -18,7 +17,6 @@ using namespace std;
 #include "flower-proto.hh"
 #include "array.hh"
 #include "string.hh"
-#include "includable-lexer.hh"
 #include "duration.hh"
 #include "pitch.hh"
 #include "protected-scm.hh"
index 31f7820f037d85e899ec89e1e75545db21665a16..332257ff807b8bea12d3b992f4e27534b75489a6 100644 (file)
@@ -1,6 +1,6 @@
 %{ // -*-Fundamental-*-
 /*
-  lexer.l -- implement the Flex lexer
+  lexer.ll -- implement the Flex lexer
 
   source file of the LilyPond music typesetter
 
 #include <ctype.h>
 #include <errno.h>
 
+/* Flex >= 2.5.29 fix; FlexLexer.h's multiple include bracing breaks
+   when building the actual lexer.  */
+#define LEXER_CC
+
 #include <iostream>
 using namespace std;
 
@@ -783,6 +787,8 @@ scan_fraction (String frac)
        return gh_cons (gh_int2scm (n), gh_int2scm (d));
 }
 
+// Breaks for flex 2.5.31
+#if 0
 /* avoid silly flex induced gcc warnings */
 static void yy_push_state (int) {;}
 static void yy_pop_state () {;}
@@ -799,6 +805,7 @@ avoid_silly_flex_induced_gcc_warnings ()
        yy_top_state ();
        avoid_silly_flex_induced_gcc_warnings ();
 }
+#endif
 
 SCM
 lookup_markup_command (String s)
index 695aeddca5aa393f7692e5ab45ae311e72a1b8e1..8851cc4e7a872d144d7ba2997bab278d2c716e2a 100644 (file)
@@ -331,6 +331,28 @@ AC_DEFUN(STEPMAKE_FLEXLEXER, [
        warn='FlexLexer.h (flex package)'
        STEPMAKE_ADD_ENTRY($1, $warn)
     fi
+    # check for yyFlexLexer.yy_current_buffer,
+    # in 2.5.4 <= flex < 2.5.29
+    AC_LANG_PUSH(C++)
+    AC_CACHE_CHECK([for yyFlexLexer.yy_current_buffer],
+       [stepmake_flexlexer_yy_current_buffer],
+       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <FlexLexer.h>
+class yy_flex_lexer: public yyFlexLexer
+{
+  public:
+    yy_flex_lexer ()
+    {
+      yy_current_buffer = 0;
+    }
+};
+]])],
+           [stepmake_flexlexer_yy_current_buffer=yes],
+           [stepmake_flexlexer_yy_current_buffer=no]))
+    if test $stepmake_flexlexer_yy_current_buffer = yes; then
+       AC_DEFINE(HAVE_FLEXLEXER_YY_CURRENT_BUFFER, 1, [Define to 1 if yyFlexLexer has yy_current_buffer.])
+    fi
+    AC_LANG_POP(C++)
 ])