summaryrefslogtreecommitdiffstats
path: root/gcc/c-lex.c
diff options
context:
space:
mode:
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>1993-12-10 20:41:43 +0000
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>1993-12-10 20:41:43 +0000
commitcb31c196547a4d7f50a29233617bc8d8e4306fcb (patch)
tree6b26074ce663a5644a4c843e5b48d46312d51d9f /gcc/c-lex.c
parentf1d214332f7bd57d0ebd97c5580f01e4fda46558 (diff)
downloadppe42-gcc-cb31c196547a4d7f50a29233617bc8d8e4306fcb.tar.gz
ppe42-gcc-cb31c196547a4d7f50a29233617bc8d8e4306fcb.zip
(yylex): When reading malformed floating point constant,
avoid printing error more than once, and avoid passing malformed number to subsequent atof call. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@6201 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r--gcc/c-lex.c8
1 files changed, 7 insertions, 1 deletions
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;
OpenPOWER on IntegriCloud