diff options
author | Jim Wilson <wilson@gcc.gnu.org> | 1993-12-10 12:41:43 -0800 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 1993-12-10 12:41:43 -0800 |
commit | b408c3fd00e6c2b53c2815c4c8513a3e71c289cf (patch) | |
tree | 6b26074ce663a5644a4c843e5b48d46312d51d9f | |
parent | 6f2f831199b6c3562f6c8338ef2e3e2ce1d56521 (diff) | |
download | gcc-b408c3fd00e6c2b53c2815c4c8513a3e71c289cf.zip gcc-b408c3fd00e6c2b53c2815c4c8513a3e71c289cf.tar.gz gcc-b408c3fd00e6c2b53c2815c4c8513a3e71c289cf.tar.bz2 |
(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
-rw-r--r-- | gcc/c-lex.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 98a9f83..b644d23 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; |