Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | From deffdb0b2497a106061d3ea2c6a3fef4fba3445e Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 29 Mar 2013 09:39:51 +0400 |
| 4 | Subject: [PATCH 35/35] wcast-qual PR/55383 |
| 5 | |
| 6 | This is a backport from gcc bugzilla |
| 7 | |
| 8 | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55383 |
| 9 | |
| 10 | This commit fixes a wrong warning behavior. This bug which has no |
| 11 | workaround other than disabling the warning. |
| 12 | |
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 14 | |
| 15 | Upstream-Status: Backport |
| 16 | --- |
| 17 | gcc/c/c-typeck.c | 2 +- |
| 18 | gcc/testsuite/c-c++-common/Wcast-qual-1.c | 6 +++--- |
| 19 | 2 files changed, 4 insertions(+), 4 deletions(-) |
| 20 | |
| 21 | diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c |
| 22 | index ddb6d39..c624120 100644 |
| 23 | --- a/gcc/c/c-typeck.c |
| 24 | +++ b/gcc/c/c-typeck.c |
| 25 | @@ -4464,7 +4464,7 @@ handle_warn_cast_qual (location_t loc, tree type, tree otype) |
| 26 | /* There are qualifiers present in IN_OTYPE that are not present |
| 27 | in IN_TYPE. */ |
| 28 | warning_at (loc, OPT_Wcast_qual, |
| 29 | - "cast discards %q#v qualifier from pointer target type", |
| 30 | + "cast discards %qv qualifier from pointer target type", |
| 31 | discarded); |
| 32 | |
| 33 | if (added || discarded) |
| 34 | diff --git a/gcc/testsuite/c-c++-common/Wcast-qual-1.c b/gcc/testsuite/c-c++-common/Wcast-qual-1.c |
| 35 | index 640e4f0..56382c7 100644 |
| 36 | --- a/gcc/testsuite/c-c++-common/Wcast-qual-1.c |
| 37 | +++ b/gcc/testsuite/c-c++-common/Wcast-qual-1.c |
| 38 | @@ -85,11 +85,11 @@ f3 (void ***bar) |
| 39 | void |
| 40 | f4 (void * const **bar) |
| 41 | { |
| 42 | - const void ***p9 = (const void ***) bar; /* { dg-warning "cast" } */ |
| 43 | + const void ***p9 = (const void ***) bar; /* { dg-warning "cast discards .const. qualifier" } */ |
| 44 | void * const **p11 = (void * const **) bar; |
| 45 | - void ** const *p13 = (void ** const *) bar; /* { dg-warning "cast" } */ |
| 46 | + void ** const *p13 = (void ** const *) bar; /* { dg-warning "cast discards .const. qualifier" } */ |
| 47 | const void * const **p15 = (const void * const **) bar; /* { dg-warning "cast" } */ |
| 48 | - const void ** const *p17 = (const void ** const *) bar; /* { dg-warning "cast" } */ |
| 49 | + const void ** const *p17 = (const void ** const *) bar; /* { dg-warning "cast discards .const. qualifier" } */ |
| 50 | void * const * const * p19 = (void * const * const *) bar; |
| 51 | const void * const * const *p21 = (const void * const * const *) bar; |
| 52 | } |
| 53 | -- |
| 54 | 1.7.10.4 |
| 55 | |