Skip to content
Commit 6fd203ac authored by Pedro Alves's avatar Pedro Alves
Browse files

For flex: define YY_FATAL_ERROR, rename fprintf -> parser_fprintf

Switching GDB to make use of gnulib's C++ namespace support mode
revealed these direct uses of fprintf in the Ada lexer:

 In file included from ..../src/gdb/ada-exp.y:731:0:
 ada-lex.c: In function ‘void yy_fatal_error(const char*)’:
 ada-lex.c:2358:41: error: call to ‘fprintf’ declared with attribute warning: The symbol ::fprintf refers to the system function. Use gnulib::fprintf instead. [-Werror]
     (void) fprintf( stderr, "%s\n", msg );
					  ^

yy_fatal_error looks like this:

 static void yy_fatal_error (yyconst char* msg )
 {
			 (void) fprintf( stderr, "%s\n", msg );
	 exit( YY_EXIT_FAILURE );
 }

We can define YY_FATAL_ERROR to override that default implementation.
However, the default implementation is still unconditionally compiled
in, so we need to handle that fprintf somehow.  Thinking that there
might be other calls introduced in other flex version or other lexers,
I chose to replace fprintf calls with sed, like we already do with
malloc/free/etc.

gdb/ChangeLog:
yyyy-mm-dd  Pedro Alves  <palves@redhat.com>

	* Makefile.in (.l.c): Also rename fprintf to parser_fprintf.
	* yy-remap.h (YY_FATAL_ERROR): Define.
parent 71d6ca3f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment