From fb55f9b8ae29f5b7d30474d4322fe4573a9aceeb Mon Sep 17 00:00:00 2001 From: David MacKenzie Date: Fri, 28 Jan 1994 19:36:53 +0000 Subject: [PATCH] * 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. --- ld/ChangeLog | 7 +++++++ ld/Makefile.in | 2 +- ld/ldlex.l | 26 ++++++++++++++++++++------ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 83a3ea843af..0d0d7845c57 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -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 diff --git a/ld/Makefile.in b/ld/Makefile.in index c61bcf210bb..30e1e7bef60 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -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 diff --git a/ld/ldlex.l b/ld/ldlex.l index 7955ac70831..ddc4d5e687e 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -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; } + +. lex_warn_invalid(" on command line", yytext); +. lex_warn_invalid(" in script", yytext); +. 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); +} -- 2.30.2