changeset 10426:4db7beace28e

oct-parse.yy, lex.ll: use symbols via gnulib namespace
author John W. Eaton <jwe@octave.org>
date Sat, 20 Mar 2010 11:01:04 -0400
parents 0677c5d80b77
children 62bb59f927b1
files src/ChangeLog src/lex.ll src/oct-parse.yy
diffstat 3 files changed, 25 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Mar 19 13:00:06 2010 +0100
+++ b/src/ChangeLog	Sat Mar 20 11:01:04 2010 -0400
@@ -1,3 +1,9 @@
+2010-03-20  John W. Eaton  <jwe@octave.org>
+
+	* lex.ll: Don't undefine GNULIB_NAMESPACE.  Define fprintf,
+	fwrite, malloc, and realloc and GNULIB_NAMESPACE::fprintf, ...
+	* oct-parse.yy: Likewise.  Always include cstdlib.
+
 2010-03-16  John W. Eaton  <jwe@octave.org>
 
 	* ls-oct-ascii.cc (save_ascii_data): Insert extra newline after
--- a/src/lex.ll	Fri Mar 19 13:00:06 2010 +0100
+++ b/src/lex.ll	Sat Mar 20 11:01:04 2010 -0400
@@ -29,9 +29,6 @@
 #include <config.h>
 #endif
 
-#if defined (GNULIB_NAMESPACE)
-#undef GNULIB_NAMESPACE
-#endif
 }
 
 %s COMMAND_START
@@ -82,6 +79,16 @@
 #include <oct-parse.h>
 #include <oct-gperf.h>
 
+#if defined (GNULIB_NAMESPACE)
+// Calls to the following functions appear in the generated output from
+// flex without the namespace tag.  Redefine them so we will use them
+// via the gnulib namespace.
+#define fprintf GNULIB_NAMESPACE::fprintf
+#define fwrite GNULIB_NAMESPACE::fwrite
+#define malloc GNULIB_NAMESPACE::malloc
+#define realloc GNULIB_NAMESPACE::realloc
+#endif
+
 #if ! (defined (FLEX_SCANNER) \
        && defined (YY_FLEX_MAJOR_VERSION) && YY_FLEX_MAJOR_VERSION >= 2 \
        && defined (YY_FLEX_MINOR_VERSION) && YY_FLEX_MINOR_VERSION >= 5)
--- a/src/oct-parse.yy	Fri Mar 19 13:00:06 2010 +0100
+++ b/src/oct-parse.yy	Sat Mar 20 11:01:04 2010 -0400
@@ -33,16 +33,9 @@
 #include <config.h>
 #endif
 
-#if defined (GNULIB_NAMESPACE)
-#undef GNULIB_NAMESPACE
-#endif
-
 #include <cassert>
 #include <cstdio>
-
-#ifdef YYBYACC
 #include <cstdlib>
-#endif
 
 #include <iostream>
 #include <map>
@@ -83,6 +76,15 @@
 #include "utils.h"
 #include "variables.h"
 
+#if defined (GNULIB_NAMESPACE)
+// Calls to the following functions appear in the generated output from
+// Bison without the namespace tag.  Redefine them so we will use them
+// via the gnulib namespace.
+#define fclose GNULIB_NAMESPACE::fclose
+#define fprintf GNULIB_NAMESPACE::fprintf
+#define malloc GNULIB_NAMESPACE::malloc
+#endif
+
 // The current input line number.
 int input_line_number = 1;