diff options
author | Marek Polacek <polacek@redhat.com> | 2014-02-06 13:57:37 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2014-02-06 13:57:37 +0000 |
commit | 0a756a3ffc875e13842708c8affcce48c9644dc7 (patch) | |
tree | 7f3617b3d19158f94a435de336f3756ce8f120e6 | |
parent | fdcee33b242a61a3915cac4ed25a43c0d8aa157f (diff) | |
download | gcc-0a756a3ffc875e13842708c8affcce48c9644dc7.zip gcc-0a756a3ffc875e13842708c8affcce48c9644dc7.tar.gz gcc-0a756a3ffc875e13842708c8affcce48c9644dc7.tar.bz2 |
re PR c/60087 (Incorrect column number for -Wsign-compare)
PR c/60087
c-family/
* c-common.c (warn_for_sign_compare): Call warning_at with location
instead of warning.
testsuite/
* gcc.dg/pr60087.c: New test.
From-SVN: r207554
-rw-r--r-- | gcc/c-family/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr60087.c | 14 |
4 files changed, 27 insertions, 2 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 38fc2d2..1e61bc3 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2014-02-06 Marek Polacek <polacek@redhat.com> + + PR c/60087 + * c-common.c (warn_for_sign_compare): Call warning_at with location + instead of warning. + 2014-02-05 Marek Polacek <polacek@redhat.com> PR c/53123 diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 007e727..50cc848 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -11285,8 +11285,8 @@ warn_for_sign_compare (location_t location, if ((mask & constant) != mask) { if (constant == 0) - warning (OPT_Wsign_compare, - "promoted ~unsigned is always non-zero"); + warning_at (location, OPT_Wsign_compare, + "promoted ~unsigned is always non-zero"); else warning_at (location, OPT_Wsign_compare, "comparison of promoted ~unsigned with constant"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 43883ce..ef4a72e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-02-06 Marek Polacek <polacek@redhat.com> + + PR c/60087 + * gcc.dg/pr60087.c: New test. + 2014-02-06 Alan Modra <amodra@gmail.com> * gcc.target/powerpc/pr60032.c: New. diff --git a/gcc/testsuite/gcc.dg/pr60087.c b/gcc/testsuite/gcc.dg/pr60087.c new file mode 100644 index 0000000..9cdd589 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr60087.c @@ -0,0 +1,14 @@ +/* PR c/60087 */ +/* { dg-do compile } */ +/* { dg-options "-Wsign-compare" } */ + +void +foo (unsigned int ui, int i) +{ + const unsigned char uc = 0; + _Bool b; + b = 0 != ~uc; /* { dg-warning "9:promoted ~unsigned is always non-zero" } */ + b = 2 != ~uc; /* { dg-warning "9:comparison of promoted ~unsigned with constant" } */ + b = uc == ~uc; /* { dg-warning "10:comparison of promoted ~unsigned with unsigned" } */ + b = i == ui; /* { dg-warning "9:comparison between signed and unsigned integer expressions" } */ +} |