diff options
author | Joseph Myers <jsm28@cam.ac.uk> | 2001-05-22 12:02:17 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2001-05-22 12:02:17 +0100 |
commit | c215b29f5ae1766a562e33e594fabcde5e64a1a6 (patch) | |
tree | f398e54c8cb6f6025faa0a96115163d6aa85eb37 /gcc | |
parent | a7bc0fbbfec9bbc01256ab9085b7783af06726fa (diff) | |
download | gcc-c215b29f5ae1766a562e33e594fabcde5e64a1a6.zip gcc-c215b29f5ae1766a562e33e594fabcde5e64a1a6.tar.gz gcc-c215b29f5ae1766a562e33e594fabcde5e64a1a6.tar.bz2 |
c-lex.c (lex_number): If pedantic and not C99...
* 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.
From-SVN: r42440
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-lex.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c90-hexfloat-1.c | 4 |
4 files changed, 19 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d21080b..b9eeac7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2001-05-22 Joseph S. Myers <jsm28@cam.ac.uk> + + * 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. + 2001-05-22 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> * README.ACORN: Remove obsolete file. diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 914da81..37d175a 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"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 661d5ea..e7247cf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-05-22 Joseph S. Myers <jsm28@cam.ac.uk> + + * gcc.dg/c90-hexfloat-1.c: Add more tests. + 2001-05-21 Geoff Keating <geoffk@redhat.com> * gcc.c-torture/compile/920520-1.x: Merge previous contents into diff --git a/gcc/testsuite/gcc.dg/c90-hexfloat-1.c b/gcc/testsuite/gcc.dg/c90-hexfloat-1.c index 9139677..122d5ee 100644 --- a/gcc/testsuite/gcc.dg/c90-hexfloat-1.c +++ b/gcc/testsuite/gcc.dg/c90-hexfloat-1.c @@ -5,3 +5,7 @@ double d = 0x1.2p2; /* { dg-bogus "warning" "warning in place of error" } */ /* { dg-error "radix 16" "hex float error" { target *-*-* } 6 } */ +double d1 = 0x1p2; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "radix 16" "hex float error" { target *-*-* } 8 } */ +double d2 = 0x1...p2; /* { dg-bogus "warning" "warning in place of error" } */ +/* { dg-error "too many decimal points" "bad hex float" { target *-*-* } 10 } */ |