* ldlex.l: Add rule to catch invalid input characters instead of

printing them.  Include "ldmain.h" for program_name decl.
	(lex_warn_invalid): New function.
	* Makefile.in: Add dependency.
This commit is contained in:
David MacKenzie 1994-01-28 19:36:53 +00:00
parent 0ffba0293e
commit fb55f9b8ae
3 changed files with 28 additions and 7 deletions

View File

@ -1,3 +1,10 @@
Fri Jan 28 09:12:56 1994 David J. Mackenzie (djm@thepub.cygnus.com)
* ldlex.l: Add rule to catch invalid input characters instead of
printing them. Include "ldmain.h" for program_name decl.
(lex_warn_invalid): New function.
* Makefile.in: Add dependency.
Fri Jan 28 12:58:45 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
* Makefile.in (check): Don't bother running any tests of

View File

@ -753,6 +753,6 @@ ldgram.o : ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/bfdlink.h ld.h ldexp.h ldver.h ldlang.h ldemul.h \
ldfile.h ldmisc.h ldmain.h mri.h ldlex.h
ldlex.o : ldlex.c ../bfd/bfd.h $(INCDIR)/obstack.h \
ld.h ldgram.h ldmisc.h ldexp.h ldlang.h ldfile.h ldlex.h
ld.h ldgram.h ldmisc.h ldexp.h ldlang.h ldfile.h ldlex.h ldmain.h
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY

View File

@ -1,6 +1,6 @@
%{
/* Copyright (C) 1991, 1993 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@ -41,6 +41,7 @@ This was written by steve chamberlain
#include "ldlang.h"
#include "ldfile.h"
#include "ldlex.h"
#include "ldmain.h"
int ldgram_in_defsym;
@ -62,13 +63,14 @@ static YY_BUFFER_STATE yy_create_string_buffer PARAMS ((const char *string,
int size));
static void yy_input PARAMS ((char *, int *result, int max_size));
static void comment PARAMS ((void));
static void lex_warn_invalid PARAMS ((char *where, char *what));
/* STATES
COMMAND on command line
COMMENT in a C comment
EXPRESSION definiatelyt in an expression
SCRIPT definately in a script
SOMEWHERE either EXPRESSION or SCRIPT
EXPRESSION definitely in an expression
SCRIPT definitely in a script
BOTH either EXPRESSION or SCRIPT
DEFSYMEXP in an argument to -defsym
MRI in an MRI script
*/
#define RTOKEN(x) { yylval.token = x; return x; }
@ -91,7 +93,6 @@ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~]
%s COMMAND
%s SCRIPT
%s EXPRESSION
%s COMMENT
%s BOTH
%s DEFSYMEXP
%s MRI
@ -449,6 +450,10 @@ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~]
return END;
}
<COMMAND>. lex_warn_invalid(" on command line", yytext);
<SCRIPT,MRI>. lex_warn_invalid(" in script", yytext);
<EXPRESSION,DEFSYMEXP,BOTH>. lex_warn_invalid(" in expression", yytext);
%%
@ -628,3 +633,12 @@ comment ()
}
}
}
static void
lex_warn_invalid (where, what)
char *where, *what;
{
fprintf(stderr,
"%s: ignoring invalid character `%s'%s\n",
program_name, what, where);
}