This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix error message from -Wcast-qual when casting away volatile


On Tue, 11 Mar 2014, Magnus Reftel wrote:
> Currently, castring away volatile from a pointer makes -Wcast-qual
> claim that __attribute__((noreturn)) was cast away (see bugzilla
> 55383). The attached patch, originally written by Manuel LÃpez-IbÃÃez
> and updated to match trunk by me, correctes that. No regressions on
> gcc from applying this patch (as reported by "make check") were seen.
> 
> 2014-03-11 Manuel LÃpez-IbÃÃez  <manu@gcc.gnu.org>
> 
>  PR c/55383
>  * c/c-typeck.c: use correct format string in cast-qual warning

I volunteer applying this if approved.

Gerald
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 524a59f..0bfc12b 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -4855,7 +4855,7 @@ handle_warn_cast_qual (location_t loc, tree type, tree otype)
     /* There are qualifiers present in IN_OTYPE that are not present
        in IN_TYPE.  */
     warning_at (loc, OPT_Wcast_qual,
-		"cast discards %q#v qualifier from pointer target type",
+		"cast discards %qv qualifier from pointer target type",
 		discarded);
 
   if (added || discarded)
diff --git a/gcc/testsuite/c-c++-common/Wcast-qual-1.c b/gcc/testsuite/c-c++-common/Wcast-qual-1.c
index 640e4f0..af80438 100644
--- a/gcc/testsuite/c-c++-common/Wcast-qual-1.c
+++ b/gcc/testsuite/c-c++-common/Wcast-qual-1.c
@@ -85,11 +85,11 @@ f3 (void ***bar)
 void
 f4 (void * const **bar)
 {
-  const void ***p9 = (const void ***) bar; /* { dg-warning "cast" } */
+  const void ***p9 = (const void ***) bar; /* { dg-warning "cast discards .const. qualifier " } */
   void * const **p11 = (void * const **) bar;
   void ** const *p13 = (void ** const *) bar; /* { dg-warning "cast" } */
   const void * const **p15 = (const void * const **) bar; /* { dg-warning "cast" } */
-  const void ** const *p17 = (const void ** const *) bar; /* { dg-warning "cast" } */
+  const void ** const *p17 = (const void ** const *) bar; /* { dg-warning "cast discards .const. qualifier" } */
   void * const * const * p19 = (void * const * const *) bar;
   const void * const * const *p21 = (const void * const * const *) bar;
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]