public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Misc. testsuite cleanups for clang.
@ 2014-09-04 20:28 Doug Evans
  0 siblings, 0 replies; only message in thread
From: Doug Evans @ 2014-09-04 20:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: dblaikie

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.

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';

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-09-04 20:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-04 20:28 [PATCH] Misc. testsuite cleanups for clang Doug Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).