Commit b408c3fd by Jim Wilson

(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
parent 6f2f8311
...@@ -1330,10 +1330,16 @@ yylex () ...@@ -1330,10 +1330,16 @@ yylex ()
{ {
if (base == 16) if (base == 16)
error ("floating constant may not be in radix 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"); error ("malformed floating constant");
floatflag = TOO_MANY_POINTS; floatflag = TOO_MANY_POINTS;
/* Avoid another error from atof by forcing all characters
from here on to be ignored. */
p[-1] = '\0';
} }
else else
floatflag = AFTER_POINT; floatflag = AFTER_POINT;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment