diff options
author | Neil Booth <neil@daikokuya.co.uk> | 2002-07-20 13:31:56 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2002-07-20 13:31:56 +0000 |
commit | 68e6527569f6ec0f520a53bcf786103a0f9b3fa4 (patch) | |
tree | 9bd94b5aaf271855796963e66d84694ac7170431 /gcc/testsuite | |
parent | 7a5611426087b57133689d61bb4717f9c82f02b2 (diff) | |
download | gcc-68e6527569f6ec0f520a53bcf786103a0f9b3fa4.zip gcc-68e6527569f6ec0f520a53bcf786103a0f9b3fa4.tar.gz gcc-68e6527569f6ec0f520a53bcf786103a0f9b3fa4.tar.bz2 |
cppexp.c (struct op): Add token pointer.
* cppexp.c (struct op): Add token pointer.
(check_promotion, CHECK_PROMOTION): New.
(optab): Update.
(_cpp_parse_expr): Update, use token pointer of struct op.
(reduce): Warn about change of sign owing to promotion.
* cppinit.c (cpp_handle_option): New warning if -Wall.
* cpplib.h (struct cpp_options): New member.
testsuite:
* gcc.dg/cpp/Wsignprom.c: New tests.
From-SVN: r55611
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/Wsignprom.c | 26 |
2 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1665509..91c63ea 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-07-20 Neil Booth <neil@daikokuya.co.uk> + + * gcc.dg/cpp/Wsignprom.c: New tests. + 2002-07-20 Alan Modra <amodra@bigpond.net.au> * gcc.c-torture/execute/loop-13.c: New test. diff --git a/gcc/testsuite/gcc.dg/cpp/Wsignprom.c b/gcc/testsuite/gcc.dg/cpp/Wsignprom.c new file mode 100644 index 0000000..44b5667 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/Wsignprom.c @@ -0,0 +1,26 @@ +/* { dg-do preprocess } */ +/* { dg-options "-Wall" } */ + +/* Test that -Wall emits the warnings about integer promotion changing + the sign of an operand. */ + +#if -1 > 0U /* { dg-warning "changes sign when promoted" } */ +#endif + +#if 0U + -1 /* { dg-warning "changes sign when promoted" } */ +#endif + +#if 0U * -1 /* { dg-warning "changes sign when promoted" } */ +#endif + +#if 1U / -2 /* { dg-warning "changes sign when promoted" } */ +#endif + +#if -1 % 1U /* { dg-warning "changes sign when promoted" } */ +#endif + +#if 1 ? 0U : -1 /* { dg-warning "changes sign when promoted" } */ +#endif + +#if 1 ? -1 : 0U /* { dg-warning "changes sign when promoted" } */ +#endif |