From b408c3fd00e6c2b53c2815c4c8513a3e71c289cf Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Fri, 10 Dec 1993 12:41:43 -0800 Subject: [PATCH] (yylex): When reading malformed floating point constant, avoid printing error more than once, and avoid passing malformed number to subsequent atof call. From-SVN: r6201 --- gcc/c-lex.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 98a9f83b0e4..b644d23177a 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -1330,10 +1330,16 @@ yylex () { if (base == 16) error ("floating constant may not be in radix 16"); - if (floatflag == AFTER_POINT) + if (floatflag == TOO_MANY_POINTS) + /* We have already emitted an error. Don't need another. */ + ; + else if (floatflag == AFTER_POINT) { error ("malformed floating constant"); floatflag = TOO_MANY_POINTS; + /* Avoid another error from atof by forcing all characters + from here on to be ignored. */ + p[-1] = '\0'; } else floatflag = AFTER_POINT;