diff mbox

Fix error message from -Wcast-qual when casting away volatile

Message ID CAESRpQA2xWP9UB1VwR17APdJ3rJLqN0ENg2=gqRJFW8cf=xNWQ@mail.gmail.com
State New
Headers show

Commit Message

Manuel López-Ibáñez March 18, 2014, 11:26 p.m. UTC
It seems that the patch was tested only in the C testsuite, but the
changes to the testcase fail for C++. So I committed the following,
which is what my patch should have done in the first place, as
obvious.

I hope this is OK with you.

Cheers,

Manuel.

dg-warning "cast" } */
   void * const * const * p19 = (void * const * const *) bar;
   const void * const * const *p21 = (const void * const * const *) bar;
 }
diff mbox

Patch

Index: gcc/testsuite/gcc.dg/cast-qual-3.c
===================================================================
--- gcc/testsuite/gcc.dg/cast-qual-3.c  (revision 0)
+++ gcc/testsuite/gcc.dg/cast-qual-3.c  (revision 208669)
@@ -0,0 +1,11 @@ 
+/* PR 55383 */
+/* { dg-do compile } */
+/* { dg-options "-Wcast-qual" } */
+
+void set(void*);
+
+int foo(int argc)
+{
+  volatile double val;
+  set((void*)&val); /* { dg-warning "cast discards .volatile. qualifier" } */
+}
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog     (revision 208668)
+++ gcc/testsuite/ChangeLog     (revision 208669)
@@ -1,3 +1,11 @@ 
+2014-03-19  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       PR c/55383
+       * gcc.dg/cast-qual-3.c: New.
+       Revert:
+       2014-03-18  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+       * c-c++-common/Wcast-qual-1.c: More precise match text.
+
 2014-03-18  Janus Weil  <janus@gcc.gnu.org>

        PR fortran/55207
Index: gcc/testsuite/c-c++-common/Wcast-qual-1.c
===================================================================
--- gcc/testsuite/c-c++-common/Wcast-qual-1.c   (revision 208668)
+++ gcc/testsuite/c-c++-common/Wcast-qual-1.c   (revision 208669)
@@ -85,11 +85,11 @@ 
 void
 f4 (void * const **bar)
 {
-  const void ***p9 = (const void ***) bar; /* { dg-warning "cast
discards .const. qualifier " } */
+  const void ***p9 = (const void ***) bar; /* { dg-warning "cast" } */
   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 discards .const. qualifier" } */
+  const void ** const *p17 = (const void ** const *) bar; /* {