This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[pph] Tweak some tests (issue4668052)


This patch adds an assertion to x1ten-hellos to make sure that the
loop counter is properly initialized and ends in 10.  It also calls
exit instead of return.

In c1eabi1.h I forgot to surround the system function signatures in
extern "C" {}.

Tested on x86_64.  Committed.


Diego.

	* g++.dg/pph/c1eabi1.h: Surround system function prototypes with
	extern "C" {}.
	* g++.dg/pph/x1ten-hellos.cc (main): Tidy.
	Assert that i is 10 at the end of the loop.
	Call exit instead of 'return 0'.
	* g++.dg/pph/x1ten-hellos.h: Do not include stdio.h.

diff --git a/gcc/testsuite/g++.dg/pph/c1eabi1.h b/gcc/testsuite/g++.dg/pph/c1eabi1.h
index 77ebfa3..f43913f 100644
--- a/gcc/testsuite/g++.dg/pph/c1eabi1.h
+++ b/gcc/testsuite/g++.dg/pph/c1eabi1.h
@@ -33,11 +33,13 @@
 /* Simplified version of c2eabi1.cc - Do not include other system
    headers here.  Simply forward declare the library functions used
    by this header.  */
-extern void abort(void);
-extern int abs(int);
-extern void exit(int);
-extern double fabs(double);
-extern int printf(const char *, ...);
+extern "C" {
+  extern void abort(void);
+  extern int abs(int);
+  extern void exit(int);
+  extern double fabs(double);
+  extern int printf(const char *, ...);
+}
 
 /* All these functions are defined to use the base ABI, so use the
    attribute to ensure the tests use the base ABI to call them even
diff --git a/gcc/testsuite/g++.dg/pph/x1ten-hellos.cc b/gcc/testsuite/g++.dg/pph/x1ten-hellos.cc
index 865b149..704b3fc 100644
--- a/gcc/testsuite/g++.dg/pph/x1ten-hellos.cc
+++ b/gcc/testsuite/g++.dg/pph/x1ten-hellos.cc
@@ -1,10 +1,17 @@
 // { dg-do run }
+
 #include "x1ten-hellos.h"
 
 int main(void)
 {
   A a;
-  for (int i = 0; i < 10; i++)
+  int i;
+
+  for (i = 0; i < 10; i++)
     a.hello();
-  return 0;
+
+  if (i != 10)
+    abort ();
+
+  exit (0);
 }
diff --git a/gcc/testsuite/g++.dg/pph/x1ten-hellos.h b/gcc/testsuite/g++.dg/pph/x1ten-hellos.h
index 2a53b66..c165c01 100644
--- a/gcc/testsuite/g++.dg/pph/x1ten-hellos.h
+++ b/gcc/testsuite/g++.dg/pph/x1ten-hellos.h
@@ -1,6 +1,10 @@
 #ifndef A_H_
 #define A_H_
-#include <stdio.h>
+extern "C" {
+  int printf(const char*, ...);
+  void abort(void);
+  void exit(int);
+};
 
 class A
 {

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]