changeset 17634:bdbf91c0a1a4

avoid warnings about symbols without gnulib:: namespace tag * oct-tex-lexer.in.ll: Define getc, fprintf, fread, fwrite, isatty, malloc, and realloc with gnulib namespace prefix. * oct-tex-parser.yy: Likewise for fclose, fprintf, and malloc.
author John W. Eaton <jwe@octave.org>
date Fri, 11 Oct 2013 13:58:23 -0400
parents 382aaf2d533a
children 7945344506ae
files libinterp/corefcn/oct-tex-lexer.in.ll libinterp/corefcn/oct-tex-parser.yy
diffstat 2 files changed, 36 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/oct-tex-lexer.in.ll	Fri Oct 11 09:39:04 2013 -0700
+++ b/libinterp/corefcn/oct-tex-lexer.in.ll	Fri Oct 11 13:58:23 2013 -0400
@@ -30,13 +30,38 @@
 #include <config.h>
 #endif
 
-#include "txt-eng.h"
-#include "oct-tex-parser.h"
 }
 
 %x	NUM_MODE
 %x	MAYBE_NUM_MODE
 
+%{
+
+// The generated code may include unistd.h.  We need that to happen
+// before defining isatty to be prefixed with the gnulib namespace
+// identifier.
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "txt-eng.h"
+#include "oct-tex-parser.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 fread GNULIB_NAMESPACE::fread
+#define fwrite GNULIB_NAMESPACE::fwrite
+#define getc GNULIB_NAMESPACE::getc
+#define isatty GNULIB_NAMESPACE::isatty
+#define malloc GNULIB_NAMESPACE::malloc
+#define realloc GNULIB_NAMESPACE::realloc
+#endif
+
+%}
+
 D       [0-9]
 NUM	(({D}+\.?{D}*)|(\.{D}+))
 
--- a/libinterp/corefcn/oct-tex-parser.yy	Fri Oct 11 09:39:04 2013 -0700
+++ b/libinterp/corefcn/oct-tex-parser.yy	Fri Oct 11 13:58:23 2013 -0400
@@ -33,6 +33,15 @@
 extern int octave_tex_lex (YYSTYPE *, void *);
 static void yyerror (text_parser_tex& parser, const char *s);
 
+#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
+
 #define scanner parser.get_scanner ()
 %}