Fix nptl/tst-cancel-self-cancelstate.c warning

Message ID alpine.DEB.2.10.1411261332200.30398@digraph.polyomino.org.uk
State Committed
Headers

Commit Message

Joseph Myers Nov. 26, 2014, 1:32 p.m. UTC
  This patch fixes "../sysdeps/nptl/pthread.h:670:26: warning:
initialization discards 'volatile' qualifier from pointer target type"
arising when building nptl/tst-cancel-self-cancelstate.c.  The problem
is passing a volatile int * to a macro expecting void *; the patch
adds an explicit cast.

Tested for x86_64.

2014-11-26  Joseph Myers  <joseph@codesourcery.com>

	* nptl/tst-cancel-self-cancelstate.c (do_test): Cast argument of
	pthread_cleanup_push to void *.
  

Comments

Ondrej Bilka Nov. 26, 2014, 4:01 p.m. UTC | #1
On Wed, Nov 26, 2014 at 01:32:52PM +0000, Joseph Myers wrote:
> This patch fixes "../sysdeps/nptl/pthread.h:670:26: warning:
> initialization discards 'volatile' qualifier from pointer target type"
> arising when building nptl/tst-cancel-self-cancelstate.c.  The problem
> is passing a volatile int * to a macro expecting void *; the patch
> adds an explicit cast.
> 
ok.
  

Patch

diff --git a/nptl/tst-cancel-self-cancelstate.c b/nptl/tst-cancel-self-cancelstate.c
index 3dce967..0defd0b 100644
--- a/nptl/tst-cancel-self-cancelstate.c
+++ b/nptl/tst-cancel-self-cancelstate.c
@@ -29,7 +29,7 @@  do_test (void)
   int ret = 0;
   volatile int should_fail = 1;
 
-  pthread_cleanup_push (cleanup, &should_fail);
+  pthread_cleanup_push (cleanup, (void *) &should_fail);
 
   if ((ret = pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL)) != 0)
     {