Patchwork Fix compiler warnings in ThreadSanitizer tests (issue5483046)

login
register
mail settings
Submitter Dmitriy Vyukov
Date Dec. 12, 2011, 1:58 p.m.
Message ID <20111212135806.B25DAC30BC@1024cores.msk.corp.google.com>
Download mbox | patch
Permalink /patch/130753/
State New
Headers show

Comments

Dmitriy Vyukov - Dec. 12, 2011, 1:58 p.m.
This is for google-main branch.
Fix compiler warnings in ThreadSanitizer tests.


--
This patch is available for review at http://codereview.appspot.com/5483046

Patch

Index: gcc/testsuite/ChangeLog.google-main
===================================================================
--- gcc/testsuite/ChangeLog.google-main	(revision 182235)
+++ gcc/testsuite/ChangeLog.google-main	(working copy)
@@ -1,3 +1,10 @@ 
+2011-12-12  Dmitry Vyukov  <dvyukov@google.com>
+
+	* gcc.dg/tsan.h: Fix compiler warnings.
+	* gcc.dg/tsan-ignore.c: Fix compiler warnings.
+	* gcc.dg/tsan-ignore.h: Fix compiler warnings.
+	* gcc.dg/tsan-mop.c: Fix compiler warnings.
+
 2011-10-17  Dehao Chen  <dehao@google.com>
 
 	* gcc.dg/record-gcc-switches-in-elf-1.c: New test.
Index: gcc/testsuite/gcc.dg/tsan.h
===================================================================
--- gcc/testsuite/gcc.dg/tsan.h	(revision 182235)
+++ gcc/testsuite/gcc.dg/tsan.h	(working copy)
@@ -15,7 +15,7 @@ 
 __thread int mop_expect = 0;
 __thread int mop_depth = 0;
 __thread void* mop_addr = 0;
-__thread unsigned long long mop_pc = 0;
+__thread unsigned long mop_pc = 0;
 __thread unsigned mop_flags = 0;
 __thread unsigned mop_line = 0;
 
@@ -40,15 +40,16 @@ 
 {
   if (mop_expect)
     {
-      printf ("missed mop: addr=%p pc=%d line=%d\n", mop_addr, mop_pc, mop_line);
+      printf ("missed mop: addr=%p pc=%p line=%d\n",
+              mop_addr, (void*)mop_pc, mop_line);
       exit (1);
     }
 
   mop_expect = 1;
   mop_depth = depth;
   mop_addr = (void*)addr;
-  mop_pc = (unsigned long long)__builtin_return_address(0);
-  mop_flags = !!is_sblock | (!!is_store << 1) | ((size - 1) << 2);
+  mop_pc = (unsigned long)__builtin_return_address(0);
+  mop_flags = (!!is_sblock) | ((!!is_store) << 1) | ((size - 1) << 2);
   mop_line = line;
 }
 
@@ -57,7 +58,7 @@ 
 void
 __tsan_handle_mop (void *addr, unsigned flags)
 {
-  unsigned long long pc;
+  unsigned long pc;
   int depth;
 
   printf ("mop: addr=%p flags=%x called from %p line=%d\n",
@@ -74,7 +75,7 @@ 
       exit (1);
     }
 
-  pc = (unsigned long long)__builtin_return_address(0);
+  pc = (unsigned long)__builtin_return_address(0);
   if (pc < mop_pc - 100 || pc > mop_pc + 100)
     {
       printf ("incorrect mop pc: %p/%p line=%d\n",
Index: gcc/testsuite/gcc.dg/tsan-ignore.c
===================================================================
--- gcc/testsuite/gcc.dg/tsan-ignore.c	(revision 182235)
+++ gcc/testsuite/gcc.dg/tsan-ignore.c	(working copy)
@@ -5,28 +5,32 @@ 
 
 /* Check ignore file handling. */
 
-int
+void
 foo (int *p)
 {
   p [0] = 1;
 }
 
-int bar (int *p)
+void
+bar (int *p)
 {
   p [0] = 1;
 }
 
-int baz (int *p)
+void
+baz (int *p)
 {
   p [0] = 1;
 }
 
-int bla (int *p)
+void
+bla (int *p)
 {
   p [0] = 1;
 }
 
-int xxx (int *p)
+void
+xxx (int *p)
 {
   p [0] = 1;
 }
Index: gcc/testsuite/gcc.dg/tsan-ignore.h
===================================================================
--- gcc/testsuite/gcc.dg/tsan-ignore.h	(revision 182235)
+++ gcc/testsuite/gcc.dg/tsan-ignore.h	(working copy)
@@ -1,4 +1,4 @@ 
-int
+void
 in_tsan_ignore_header (int *p)
 {
   p [0] = 1;
Index: gcc/testsuite/gcc.dg/tsan-mop.c
===================================================================
--- gcc/testsuite/gcc.dg/tsan-mop.c	(revision 182235)
+++ gcc/testsuite/gcc.dg/tsan-mop.c	(working copy)
@@ -28,7 +28,7 @@ 
 
   __tsan_expect_mop(2, &p->x, 0, 1, sizeof(p->x), __LINE__);
   tmp = p->x;
-
+  (void)tmp;
 }
 
 void testfor (P *p)
@@ -54,6 +54,7 @@ 
 
   __tsan_expect_mop(1, &p.x, 0, 1, sizeof(p.x), __LINE__);
   tmp = p.x;
+  (void)tmp;
 
   __tsan_expect_mop(1, &p.cp, 1, 1, sizeof(p.cp), __LINE__);
   p.cp = &p.c;