This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] libffi testsuite extension
- From: Andreas Tobler <toa at pop dot agri dot ch>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 08 Nov 2003 18:37:35 +0100
- Subject: [patch] libffi testsuite extension
Hi all,
I commit the attached patch to the libffi testsuite.
Tested on darwin and hppa.
Andreas
2003-11-08 Andreas Tobler <a.tobler@schweiz.ch>
* testsuite/libffi.call/cls_double.c: Do a check on the result.
* testsuite/libffi.call/cls_uchar.c: Likewise.
* testsuite/libffi.call/cls_uint.c: Likewise.
* testsuite/libffi.call/cls_ulonglong.c: Likewise.
* testsuite/libffi.call/cls_ushort.c: Likewise.
* testsuite/libffi.call/return_sc.c: Cleanup whitespaces.
Index: cls_double.c
===================================================================
RCS file: /cvs/gcc/gcc/libffi/testsuite/libffi.call/cls_double.c,v
retrieving revision 1.2
diff -u -r1.2 cls_double.c
--- cls_double.c 19 Sep 2003 19:21:53 -0000 1.2
+++ cls_double.c 8 Nov 2003 17:27:03 -0000
@@ -23,7 +23,7 @@
static ffi_closure cl;
ffi_closure *pcl = &cl;
ffi_type * cl_arg_types[2];
-
+ double res;
cl_arg_types[0] = &ffi_type_double;
cl_arg_types[1] = NULL;
@@ -34,7 +34,8 @@
CHECK(ffi_prep_closure(pcl, &cif, cls_ret_double_fn, NULL) == FFI_OK);
- (*((cls_ret_double)pcl))(21474.789);
+ res = (*((cls_ret_double)pcl))(21474.789);
/* { dg-output "21474.789000: 21474.789000" } */
+ CHECK(res == 21474.789000);
exit(0);
}
Index: cls_uchar.c
===================================================================
RCS file: /cvs/gcc/gcc/libffi/testsuite/libffi.call/cls_uchar.c,v
retrieving revision 1.2
diff -u -r1.2 cls_uchar.c
--- cls_uchar.c 19 Sep 2003 19:21:53 -0000 1.2
+++ cls_uchar.c 8 Nov 2003 17:27:03 -0000
@@ -22,7 +22,7 @@
static ffi_closure cl;
ffi_closure *pcl = &cl;
ffi_type * cl_arg_types[2];
-
+ unsigned char res;
cl_arg_types[0] = &ffi_type_uchar;
cl_arg_types[1] = NULL;
@@ -33,8 +33,8 @@
CHECK(ffi_prep_closure(pcl, &cif, cls_ret_uchar_fn, NULL) == FFI_OK);
- (*((cls_ret_uchar)pcl))(127);
+ res = (*((cls_ret_uchar)pcl))(127);
/* { dg-output "127: 127" } */
-
+ CHECK(res == 127);
exit(0);
}
Index: cls_uint.c
===================================================================
RCS file: /cvs/gcc/gcc/libffi/testsuite/libffi.call/cls_uint.c,v
retrieving revision 1.2
diff -u -r1.2 cls_uint.c
--- cls_uint.c 19 Sep 2003 19:21:53 -0000 1.2
+++ cls_uint.c 8 Nov 2003 17:27:03 -0000
@@ -23,7 +23,7 @@
static ffi_closure cl;
ffi_closure *pcl = &cl;
ffi_type * cl_arg_types[2];
-
+ unsigned int res;
cl_arg_types[0] = &ffi_type_uint32;
cl_arg_types[1] = NULL;
@@ -34,8 +34,8 @@
CHECK(ffi_prep_closure(pcl, &cif, cls_ret_uint_fn, NULL) == FFI_OK);
- (*((cls_ret_uint)pcl))(2147483647);
+ res = (*((cls_ret_uint)pcl))(2147483647);
/* { dg-output "2147483647: 2147483647" } */
-
+ CHECK(res == 2147483647);
exit(0);
}
Index: cls_ulonglong.c
===================================================================
RCS file: /cvs/gcc/gcc/libffi/testsuite/libffi.call/cls_ulonglong.c,v
retrieving revision 1.2
diff -u -r1.2 cls_ulonglong.c
--- cls_ulonglong.c 19 Sep 2003 19:21:53 -0000 1.2
+++ cls_ulonglong.c 8 Nov 2003 17:27:03 -0000
@@ -23,6 +23,7 @@
static ffi_closure cl;
ffi_closure *pcl = &cl;
ffi_type * cl_arg_types[2];
+ unsigned long long res;
cl_arg_types[0] = &ffi_type_uint64;
cl_arg_types[1] = NULL;
@@ -31,10 +32,11 @@
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_uint64, cl_arg_types) == FFI_OK);
CHECK(ffi_prep_closure(pcl, &cif, cls_ret_ulonglong_fn, NULL) == FFI_OK);
- (*((cls_ret_ulonglong)pcl))(214LL);
+ res = (*((cls_ret_ulonglong)pcl))(214LL);
/* { dg-output "214: 214" } */
- (*((cls_ret_ulonglong)pcl))(9223372035854775808LL);
+ CHECK(res == 214LL);
+ res = (*((cls_ret_ulonglong)pcl))(9223372035854775808LL);
/* { dg-output "\n9223372035854775808: 9223372035854775808" } */
-
+ CHECK(res == 9223372035854775808LL);
exit(0);
}
Index: cls_ushort.c
===================================================================
RCS file: /cvs/gcc/gcc/libffi/testsuite/libffi.call/cls_ushort.c,v
retrieving revision 1.2
diff -u -r1.2 cls_ushort.c
--- cls_ushort.c 19 Sep 2003 19:21:53 -0000 1.2
+++ cls_ushort.c 8 Nov 2003 17:27:03 -0000
@@ -23,7 +23,7 @@
static ffi_closure cl;
ffi_closure *pcl = &cl;
ffi_type * cl_arg_types[2];
-
+ unsigned short res;
cl_arg_types[0] = &ffi_type_ushort;
cl_arg_types[1] = NULL;
@@ -34,8 +34,8 @@
CHECK(ffi_prep_closure(pcl, &cif, cls_ret_ushort_fn, NULL) == FFI_OK);
- (*((cls_ret_ushort)pcl))(65535);
+ res = (*((cls_ret_ushort)pcl))(65535);
/* { dg-output "65535: 65535" } */
-
+ CHECK(res == 65535);
exit(0);
}
Index: return_sc.c
===================================================================
RCS file: /cvs/gcc/gcc/libffi/testsuite/libffi.call/return_sc.c,v
retrieving revision 1.1
diff -u -r1.1 return_sc.c
--- return_sc.c 4 Sep 2003 14:47:48 -0000 1.1
+++ return_sc.c 8 Nov 2003 17:27:03 -0000
@@ -22,12 +22,12 @@
args[0] = &ffi_type_schar;
values[0] = ≻
-
+
/* Initialize the cif */
- CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
+ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_schar, args) == FFI_OK);
-
- for (sc = (signed char) -127;
+
+ for (sc = (signed char) -127;
sc < (signed char) 127; sc++)
{
ul++;