Misc. testsuite cleanups for clang.

Message ID yjt2egvrgmfy.fsf@ruffy.mtv.corp.google.com
State New, archived
Headers

Commit Message

Doug Evans Sept. 4, 2014, 8:28 p.m. UTC
  Hi.

These tests fail with clang due to compilation errors.
I've studied these tests and believe the changes
don't influence the intent of the test.

Regression tested on amd64-linux with gcc and clang.

2014-09-04  Doug Evans  <dje@google.com>

	Misc. testsuite cleanups for clang.
	* gdb.base/call-sc.c (zed): Specify result is void.
	* gdb.base/savedreges (caller): Add parentheses to expression.
	(thrower): Add volatile to *(char *)0.
	(main): Add int result type.
	* gdb.base/structs.c (zed): Specify result is void.
  

Patch

diff --git a/gdb/testsuite/gdb.base/call-sc.c b/gdb/testsuite/gdb.base/call-sc.c
index cec4b34..b9260b9 100644
--- a/gdb/testsuite/gdb.base/call-sc.c
+++ b/gdb/testsuite/gdb.base/call-sc.c
@@ -51,7 +51,7 @@  void Fun(foo)
   L = foo;
 }
 
-zed ()
+void zed ()
 {
   L = 'Z';
 }
diff --git a/gdb/testsuite/gdb.base/savedregs.c b/gdb/testsuite/gdb.base/savedregs.c
index b886787..23c764e 100644
--- a/gdb/testsuite/gdb.base/savedregs.c
+++ b/gdb/testsuite/gdb.base/savedregs.c
@@ -33,7 +33,8 @@  callee (int param)
 extern int
 caller (int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
 {
-  return callee (a1 << a2 * a3 / a4 + a6 & a6 % a7 - a8) + done;
+  /* Note: The extra parentheses are to silence clang warnings.  */
+  return callee (a1 << (a2 * a3 / a4 + a6) & a6 % a7 - a8) + done;
 }
 
 static void
@@ -45,8 +46,9 @@  catcher (int sig)
 static void
 thrower (void)
 {
-  /* Trigger a SIGSEGV.  */
-  *(char *)0 = 0;
+  /* Trigger a SIGSEGV.
+     A volatile pointer is used to silence a clang warning.  */
+  *(volatile char *)0 = 0;
 
   /* On MMU-less system, previous memory access to address zero doesn't
      trigger a SIGSEGV.  Trigger a SIGILL.  Each arch should define its
@@ -61,7 +63,7 @@  thrower (void)
 
 }
 
-main ()
+int main ()
 {
   signal (SIGILL, catcher);
   signal (SIGSEGV, catcher);
diff --git a/gdb/testsuite/gdb.base/structs.c b/gdb/testsuite/gdb.base/structs.c
index 60772bb..9ff0b35 100644
--- a/gdb/testsuite/gdb.base/structs.c
+++ b/gdb/testsuite/gdb.base/structs.c
@@ -356,7 +356,7 @@  void Fun18(foo18)
   L18 = foo18; 
 }
 
-zed ()
+void zed ()
 {
 
   L1.a = L2.a = L3.a = L4.a = L5.a = L6.a = L7.a = L8.a = L9.a = L10.a = L11.a = L12.a = L13.a = L14.a = L15.a = L16.a = L17.a = L18.a = 'Z';