diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-22 11:02:17 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-22 11:02:17 +0000 |
commit | eb5b685e4b32035bb45385de0d980d4220fd6812 (patch) | |
tree | f398e54c8cb6f6025faa0a96115163d6aa85eb37 /gcc/c-lex.c | |
parent | 00ed89e144213f7e7ee98bfb6ab32fff87c17379 (diff) | |
download | gcc-eb5b685e4b32035bb45385de0d980d4220fd6812.tar.gz |
* c-lex.c (lex_number): If pedantic and not C99, pedwarn exactly
once for hexadecimal floats, whether or not they contain a decimal
point. Don't let the setting of pedantic otherwise affect the
parsing of hexadecimal floats.
testsuite:
* gcc.dg/c90-hexfloat-1.c: Add more tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42440 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r-- | gcc/c-lex.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 914da81cd92..37d175a4c62 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -1092,9 +1092,7 @@ lex_number (str, len) if (c == '.') { - if (base == 16 && pedantic && !flag_isoc99) - pedwarn ("floating constant may not be in radix 16"); - else if (floatflag == AFTER_POINT) + if (floatflag == AFTER_POINT) ERROR ("too many decimal points in floating constant"); else if (floatflag == AFTER_EXPON) ERROR ("decimal point in exponent - impossible!"); @@ -1190,6 +1188,9 @@ lex_number (str, len) struct pf_args args; char *copy; + if (base == 16 && pedantic && !flag_isoc99) + pedwarn ("floating constant may not be in radix 16"); + if (base == 16 && floatflag != AFTER_EXPON) ERROR ("hexadecimal floating constant has no exponent"); |