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]

PATCH: Move gcc.dg/callabi to gcc.target/x86_64/abi/callabi


There are 2 problems with gcc.dg/callabi:

1. They are specific to x86-64 ABI.
2. Linux/x86-64 also supports 32bit. All tests will fail with
--target_board 'unix{-m32}'.

This patch moves gcc.dg/callabi to gcc.target/x86_64/abi/callabi
and check proper targets in callabi.exp. OK for trunk?

Thanks.

H.J.
----
2009-02-18  H.J. Lu  <hongjiu.lu@intel.com>

	* gcc.dg/callabi/callabi.exp: Moved to ...
	* gcc.target/x86_64/abi/callabi/callabi.exp: Here.  Only run
	in 64bit mode.

	* gcc.target/x86_64/abi/callabi/func-1.c: Don't check target.
	* gcc.target/x86_64/abi/callabi/func-indirect.c: Likewise.
	* gcc.target/x86_64/abi/callabi/func-indirect.c: Likewise.
	* gcc.target/x86_64/abi/callabi/pr38891.c: Likewise.
	* gcc.target/x86_64/abi/callabi/vaarg-1.c: Likewise.
	* gcc.target/x86_64/abi/callabi/vaarg-2.c: Likewise.
	* gcc.target/x86_64/abi/callabi/vaarg-3.c: Likewise.

	* gcc.dg/callabi/callabi.h: Moved to ...
	* gcc.target/x86_64/abi/callabi/callabi.h: Here.

	* gcc.dg/callabi/func-1.c: Moved to ...
	* gcc.target/x86_64/abi/callabi/func-1.c: Here.

	* gcc.dg/callabi/func-indirect.c: Moved to ...
	* gcc.target/x86_64/abi/callabi/func-indirect.c: Here.

	* gcc.dg/callabi/pr38891.c: Moved to ...
	* gcc.target/x86_64/abi/callabi/pr38891.c: Here.

	* gcc.dg/callabi/vaarg-1.c: Moved to ...
	* gcc.target/x86_64/abi/callabi/vaarg-1.c: Here.

	* gcc.dg/callabi/vaarg-2.c: Moved to ...
	* gcc.target/x86_64/abi/callabi/vaarg-2.c: Here.

	* gcc.dg/callabi/vaarg-3.c: Moved to ...
	* gcc.target/x86_64/abi/callabi/vaarg-3.c: Here.

--- gcc/testsuite/gcc.dg/callabi/callabi.exp.foo	2009-02-18 06:19:09.000000000 -0800
+++ gcc/testsuite/gcc.dg/callabi/callabi.exp	2009-02-18 06:34:24.000000000 -0800
@@ -1,31 +0,0 @@
-#   Copyright (C) 2009 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3.  If not see
-# <http://www.gnu.org/licenses/>.
-
-# GCC testsuite that uses the `dg.exp' driver.
-
-# Load support procs.
-load_lib gcc-dg.exp
-
-# If a testcase doesn't have special options, use these.
-global DEFAULT_CFLAGS
-if ![info exists DEFAULT_CFLAGS] then {
-    set DEFAULT_CFLAGS " -ansi -pedantic-errors"
-}
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
-    "" $DEFAULT_CFLAGS
-dg-finish
--- gcc/testsuite/gcc.dg/callabi/callabi.h.foo	2008-07-06 08:01:38.000000000 -0700
+++ gcc/testsuite/gcc.dg/callabi/callabi.h	2009-02-18 06:34:24.000000000 -0800
@@ -1,50 +0,0 @@
-/* First the default target definition.  */
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-  typedef __builtin_va_list __gnuc_va_list;
-#endif
-
-#ifndef _VA_LIST_DEFINED
-#define _VA_LIST_DEFINED
-  typedef __gnuc_va_list va_list;
-#endif
-
-#define __va_copy(d,s)	__builtin_va_copy(d,s)
-#define __va_start(v,l)	__builtin_va_start(v,l)
-#define __va_arg(v,l)	__builtin_va_arg(v,l)
-#define __va_end(v)	__builtin_va_end(v)
-
-#define __ms_va_copy(d,s) __builtin_ms_va_copy(d,s)
-#define __ms_va_start(v,l) __builtin_ms_va_start(v,l)
-#define __ms_va_arg(v,l)	__builtin_va_arg(v,l)
-#define __ms_va_end(v) __builtin_ms_va_end(v)
-
-#define __sysv_va_copy(d,s) __builtin_sysv_va_copy(d,s)
-#define __sysv_va_start(v,l) __builtin_sysv_va_start(v,l)
-#define __sysv_va_arg(v,l)	__builtin_va_arg(v,l)
-#define __sysv_va_end(v) __builtin_sysv_va_end(v)
-
-#define CALLABI_NATIVE
-
-#ifdef _WIN64
-#define CALLABI_CROSS __attribute__ ((sysv_abi))
-
-#define CROSS_VA_LIST	__builtin_sysv_va_list
-
-#define CROSS_VA_COPY(d,s) __sysv_va_copy(d,s)
-#define CROSS_VA_START(v,l) __sysv_va_start(v,l)
-#define CROSS_VA_ARG(v,l) __sysv_va_arg(v,l)
-#define CROSS_VA_END(v)  __sysv_va_end(v)
-
-#else
-
-#define CALLABI_CROSS __attribute__ ((ms_abi))
-
-#define CROSS_VA_LIST	__builtin_ms_va_list
-
-#define CROSS_VA_COPY(d,s) __ms_va_copy(d,s)
-#define CROSS_VA_START(v,l) __ms_va_start(v,l)
-#define CROSS_VA_ARG(v,l) __ms_va_arg(v,l)
-#define CROSS_VA_END(v)  __ms_va_end(v)
-
-#endif
\ No newline at end of file
--- gcc/testsuite/gcc.dg/callabi/func-1.c.foo	2008-07-06 08:01:38.000000000 -0700
+++ gcc/testsuite/gcc.dg/callabi/func-1.c	2009-02-18 06:34:24.000000000 -0800
@@ -1,40 +0,0 @@
-/* Test for cross x86_64<->w64 abi standard calls.
-*/
-/* Origin: Kai Tietz <kai.tietz@onevision.com> */
-/* { dg-do run { target { x86_64-*-* } } } */
-/* { dg-options "-std=gnu99 -ffast-math" } */
-#include "callabi.h"
-
-extern void abort (void);
-
-long double
-CALLABI_CROSS func_cross (long double a, double b, float c, long d, int e,
-			  char f)
-{
-  long double ret;
-  ret = a + (long double) b + (long double) c;
-  ret *= (long double) (d + (long) e);
-  if (f>0)
-    ret += func_cross (a,b,c,d,e,-f);
-  return ret;
-}
-
-long double
-CALLABI_NATIVE func_native (long double a, double b, float c, long d, int e,
-			    char f)
-{
-  long double ret;
-  ret = a + (long double) b + (long double) c;
-  ret *= (long double) (d + (long) e);
-  if (f>0)
-    ret += func_native (a,b,c,d,e,-f);
-  return ret;
-}
-
-int main ()
-{
-  if (func_cross (1.0,2.0,3.0,1,2,3)
-      != func_native (1.0,2.0,3.0,1,2,3))
-    abort ();
-  return 0;
-}
\ No newline at end of file
--- gcc/testsuite/gcc.dg/callabi/func-indirect.c.foo	2008-11-29 08:19:36.000000000 -0800
+++ gcc/testsuite/gcc.dg/callabi/func-indirect.c	2009-02-18 06:34:24.000000000 -0800
@@ -1,24 +0,0 @@
-/* Test for cross x86_64<->w64 abi standard calls via variable.
-*/
-/* Origin: Kai Tietz <kai.tietz@onevision.com> */
-/* { dg-do run { target { x86_64-*-* } } } */
-/* { dg-options "-std=gnu99 -ffast-math" } */
-#include "callabi.h"
-
-extern void abort (void);
-
-typedef int (CALLABI_CROSS *func)(void *, char *, char *, short, long long);
-
-int CALLABI_CROSS
-callback(void * ptr, char *string1, char *string2, short number, long long rand)
-{
-    return (rand != 0x1234567890abcdefLL);
-}
-
-int main()
-{
-    volatile func callme = callback;
-    if(callme(0, 0, 0, 0, 0x1234567890abcdefLL))
-     abort();
-}
-
--- gcc/testsuite/gcc.dg/callabi/pr38891.c.foo	2009-02-18 06:19:09.000000000 -0800
+++ gcc/testsuite/gcc.dg/callabi/pr38891.c	2009-02-18 06:34:24.000000000 -0800
@@ -1,10 +0,0 @@
-/* Test for cross x86_64<->w64 abi standard calls.
-*/
-/* { dg-do compile { target { x86_64-*-* } } } */
-/* { dg-options "-mno-sse" } */
-#include "callabi.h"
-
-long double
-CALLABI_CROSS func_cross ()
-{
-}
--- gcc/testsuite/gcc.dg/callabi/vaarg-1.c.foo	2008-07-06 08:01:38.000000000 -0700
+++ gcc/testsuite/gcc.dg/callabi/vaarg-1.c	2009-02-18 06:34:24.000000000 -0800
@@ -1,47 +0,0 @@
-/* Test for cross x86_64<->w64 abi va_list calls.
-*/
-/* Origin: Kai Tietz <kai.tietz@onevision.com> */
-/* { dg-do run { target { x86_64-*-* } } } */
-/* { dg-options "-std=gnu99" } */
-#include "callabi.h"
-
-extern __SIZE_TYPE__ strlen (const char *);
-extern int sprintf (char *,const char *, ...);
-extern void abort (void);
-
-static
-void CALLABI_CROSS vdo_cpy (char *s, CROSS_VA_LIST argp)
-{
-  __SIZE_TYPE__ len;
-  char *r = s;
-  char *e;
-  *r = 0;
-  for (;;) {
-    e = CROSS_VA_ARG (argp,char *);
-    if (*e == 0) break;
-    sprintf (r,"%s", e);
-    r += strlen (r);
-  }
-}
-
-static
-void CALLABI_CROSS do_cpy (char *s, ...)
-{
-  CROSS_VA_LIST argp;
-  CROSS_VA_START (argp, s);
-  vdo_cpy (s, argp);
-  CROSS_VA_END (argp);
-}
-
-int main ()
-{
-  char s[256];
-
-  do_cpy (s, "1","2","3","4", "5", "6", "7", "");
-
-  if (s[0] != '1' || s[1] !='2' || s[2] != '3' || s[3] != '4'
-      || s[4] != '5' || s[5] != '6' || s[6] != '7' || s[7] != 0)
-    abort ();
-
-  return 0;
-}
--- gcc/testsuite/gcc.dg/callabi/vaarg-2.c.foo	2008-07-06 08:01:38.000000000 -0700
+++ gcc/testsuite/gcc.dg/callabi/vaarg-2.c	2009-02-18 06:34:24.000000000 -0800
@@ -1,47 +0,0 @@
-/* Test for cross x86_64<->w64 abi va_list calls.
-*/
-/* Origin: Kai Tietz <kai.tietz@onevision.com> */
-/* { dg-do run { target { x86_64-*-* } } } */
-/* { dg-options "-std=gnu99" } */
-#include "callabi.h"
-
-extern void abort (void);
-
-#define SZ_ARGS	1ll,2ll,3ll,4ll,5ll,6ll,7ll,0ll
-
-static
-int CALLABI_CROSS fct1 (va_list argp, ...)
-{
-  long long p1,p2;
-  int ret = 1;
-  CROSS_VA_LIST argp_2;
-  CROSS_VA_START (argp_2,argp);
-
-  do {
-    p1 = CROSS_VA_ARG (argp_2, long long);
-    p2 = __va_arg (argp, long long);
-    if (p1 != p2)
-      ret = 0;
-  } while (ret && p1 != 0);
-  CROSS_VA_END (argp_2);
-  return ret;
-}
-
-static
-int fct2 (int dummy, ...)
-{
-  va_list argp;
-  int ret = dummy;
-
-  __va_start (argp, dummy);
-  ret += fct1 (argp, SZ_ARGS);
-  __va_end (argp);
-  return ret;
-}
-
-int main()
-{
-  if (fct2 (-1, SZ_ARGS) != 0)
-    abort ();
-  return 0;
-}
--- gcc/testsuite/gcc.dg/callabi/vaarg-3.c.foo	2008-07-06 08:01:38.000000000 -0700
+++ gcc/testsuite/gcc.dg/callabi/vaarg-3.c	2009-02-18 06:34:24.000000000 -0800
@@ -1,47 +0,0 @@
-/* Test for cross x86_64<->w64 abi va_list calls.
-*/
-/* Origin: Kai Tietz <kai.tietz@onevision.com> */
-/* { dg-do run { target { x86_64-*-* } } } */
-/* { dg-options "-std=gnu99" } */
-#include "callabi.h"
-
-extern void abort (void);
-
-#define SZ_ARGS	1ll,2ll,3ll,4ll,5ll,6ll,7ll,0ll
-
-static
-int fct1 (CROSS_VA_LIST argp, ...)
-{
-  long long p1,p2;
-  int ret = 1;
-  va_list argp_2;
-
-    __va_start (argp_2,argp);
-  do {
-    p1 = __va_arg (argp_2, long long);
-    p2 = CROSS_VA_ARG (argp, long long);
-    if (p1 != p2)
-      ret = 0;
-  } while (ret && p1 != 0);
-  __va_end (argp_2);
-  return ret;
-}
-
-static
-int CALLABI_CROSS fct2 (int dummy, ...)
-{
-  CROSS_VA_LIST argp;
-  int ret = dummy;
-
-  CROSS_VA_START (argp, dummy);
-  ret += fct1 (argp, SZ_ARGS);
-  CROSS_VA_END (argp);
-  return ret;
-}
-
-int main()
-{
-  if (fct2 (-1, SZ_ARGS) != 0)
-    abort ();
-  return 0;
-}
--- gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.exp.foo	2009-02-18 06:34:00.000000000 -0800
+++ gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.exp	2009-02-18 06:31:44.000000000 -0800
@@ -0,0 +1,36 @@
+#   Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+if { (![istarget x86_64-*-*] && ![istarget i?86-*-*])
+     || ![is-effective-target lp64] } then {
+  return
+}
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+    set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+dg-init
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
+    "" $DEFAULT_CFLAGS
+dg-finish
--- gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.h.foo	2009-02-18 06:34:00.000000000 -0800
+++ gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.h	2008-07-06 08:01:38.000000000 -0700
@@ -0,0 +1,50 @@
+/* First the default target definition.  */
+#ifndef __GNUC_VA_LIST
+#define __GNUC_VA_LIST
+  typedef __builtin_va_list __gnuc_va_list;
+#endif
+
+#ifndef _VA_LIST_DEFINED
+#define _VA_LIST_DEFINED
+  typedef __gnuc_va_list va_list;
+#endif
+
+#define __va_copy(d,s)	__builtin_va_copy(d,s)
+#define __va_start(v,l)	__builtin_va_start(v,l)
+#define __va_arg(v,l)	__builtin_va_arg(v,l)
+#define __va_end(v)	__builtin_va_end(v)
+
+#define __ms_va_copy(d,s) __builtin_ms_va_copy(d,s)
+#define __ms_va_start(v,l) __builtin_ms_va_start(v,l)
+#define __ms_va_arg(v,l)	__builtin_va_arg(v,l)
+#define __ms_va_end(v) __builtin_ms_va_end(v)
+
+#define __sysv_va_copy(d,s) __builtin_sysv_va_copy(d,s)
+#define __sysv_va_start(v,l) __builtin_sysv_va_start(v,l)
+#define __sysv_va_arg(v,l)	__builtin_va_arg(v,l)
+#define __sysv_va_end(v) __builtin_sysv_va_end(v)
+
+#define CALLABI_NATIVE
+
+#ifdef _WIN64
+#define CALLABI_CROSS __attribute__ ((sysv_abi))
+
+#define CROSS_VA_LIST	__builtin_sysv_va_list
+
+#define CROSS_VA_COPY(d,s) __sysv_va_copy(d,s)
+#define CROSS_VA_START(v,l) __sysv_va_start(v,l)
+#define CROSS_VA_ARG(v,l) __sysv_va_arg(v,l)
+#define CROSS_VA_END(v)  __sysv_va_end(v)
+
+#else
+
+#define CALLABI_CROSS __attribute__ ((ms_abi))
+
+#define CROSS_VA_LIST	__builtin_ms_va_list
+
+#define CROSS_VA_COPY(d,s) __ms_va_copy(d,s)
+#define CROSS_VA_START(v,l) __ms_va_start(v,l)
+#define CROSS_VA_ARG(v,l) __ms_va_arg(v,l)
+#define CROSS_VA_END(v)  __ms_va_end(v)
+
+#endif
\ No newline at end of file
--- gcc/testsuite/gcc.target/x86_64/abi/callabi/func-1.c.foo	2009-02-18 06:34:00.000000000 -0800
+++ gcc/testsuite/gcc.target/x86_64/abi/callabi/func-1.c	2009-02-18 06:32:43.000000000 -0800
@@ -0,0 +1,40 @@
+/* Test for cross x86_64<->w64 abi standard calls.
+*/
+/* Origin: Kai Tietz <kai.tietz@onevision.com> */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99 -ffast-math" } */
+#include "callabi.h"
+
+extern void abort (void);
+
+long double
+CALLABI_CROSS func_cross (long double a, double b, float c, long d, int e,
+			  char f)
+{
+  long double ret;
+  ret = a + (long double) b + (long double) c;
+  ret *= (long double) (d + (long) e);
+  if (f>0)
+    ret += func_cross (a,b,c,d,e,-f);
+  return ret;
+}
+
+long double
+CALLABI_NATIVE func_native (long double a, double b, float c, long d, int e,
+			    char f)
+{
+  long double ret;
+  ret = a + (long double) b + (long double) c;
+  ret *= (long double) (d + (long) e);
+  if (f>0)
+    ret += func_native (a,b,c,d,e,-f);
+  return ret;
+}
+
+int main ()
+{
+  if (func_cross (1.0,2.0,3.0,1,2,3)
+      != func_native (1.0,2.0,3.0,1,2,3))
+    abort ();
+  return 0;
+}
--- gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect.c.foo	2009-02-18 06:34:00.000000000 -0800
+++ gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect.c	2009-02-18 06:32:46.000000000 -0800
@@ -0,0 +1,24 @@
+/* Test for cross x86_64<->w64 abi standard calls via variable.
+*/
+/* Origin: Kai Tietz <kai.tietz@onevision.com> */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99 -ffast-math" } */
+#include "callabi.h"
+
+extern void abort (void);
+
+typedef int (CALLABI_CROSS *func)(void *, char *, char *, short, long long);
+
+int CALLABI_CROSS
+callback(void * ptr, char *string1, char *string2, short number, long long rand)
+{
+    return (rand != 0x1234567890abcdefLL);
+}
+
+int main()
+{
+    volatile func callme = callback;
+    if(callme(0, 0, 0, 0, 0x1234567890abcdefLL))
+     abort();
+}
+
--- gcc/testsuite/gcc.target/x86_64/abi/callabi/pr38891.c.foo	2009-02-18 06:34:00.000000000 -0800
+++ gcc/testsuite/gcc.target/x86_64/abi/callabi/pr38891.c	2009-02-18 06:32:09.000000000 -0800
@@ -0,0 +1,10 @@
+/* Test for cross x86_64<->w64 abi standard calls.
+*/
+/* { dg-do compile } */
+/* { dg-options "-mno-sse" } */
+#include "callabi.h"
+
+long double
+CALLABI_CROSS func_cross ()
+{
+}
--- gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-1.c.foo	2009-02-18 06:34:00.000000000 -0800
+++ gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-1.c	2009-02-18 06:32:52.000000000 -0800
@@ -0,0 +1,47 @@
+/* Test for cross x86_64<->w64 abi va_list calls.
+*/
+/* Origin: Kai Tietz <kai.tietz@onevision.com> */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+#include "callabi.h"
+
+extern __SIZE_TYPE__ strlen (const char *);
+extern int sprintf (char *,const char *, ...);
+extern void abort (void);
+
+static
+void CALLABI_CROSS vdo_cpy (char *s, CROSS_VA_LIST argp)
+{
+  __SIZE_TYPE__ len;
+  char *r = s;
+  char *e;
+  *r = 0;
+  for (;;) {
+    e = CROSS_VA_ARG (argp,char *);
+    if (*e == 0) break;
+    sprintf (r,"%s", e);
+    r += strlen (r);
+  }
+}
+
+static
+void CALLABI_CROSS do_cpy (char *s, ...)
+{
+  CROSS_VA_LIST argp;
+  CROSS_VA_START (argp, s);
+  vdo_cpy (s, argp);
+  CROSS_VA_END (argp);
+}
+
+int main ()
+{
+  char s[256];
+
+  do_cpy (s, "1","2","3","4", "5", "6", "7", "");
+
+  if (s[0] != '1' || s[1] !='2' || s[2] != '3' || s[3] != '4'
+      || s[4] != '5' || s[5] != '6' || s[6] != '7' || s[7] != 0)
+    abort ();
+
+  return 0;
+}
--- gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-2.c.foo	2009-02-18 06:34:00.000000000 -0800
+++ gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-2.c	2009-02-18 06:32:57.000000000 -0800
@@ -0,0 +1,47 @@
+/* Test for cross x86_64<->w64 abi va_list calls.
+*/
+/* Origin: Kai Tietz <kai.tietz@onevision.com> */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+#include "callabi.h"
+
+extern void abort (void);
+
+#define SZ_ARGS	1ll,2ll,3ll,4ll,5ll,6ll,7ll,0ll
+
+static
+int CALLABI_CROSS fct1 (va_list argp, ...)
+{
+  long long p1,p2;
+  int ret = 1;
+  CROSS_VA_LIST argp_2;
+  CROSS_VA_START (argp_2,argp);
+
+  do {
+    p1 = CROSS_VA_ARG (argp_2, long long);
+    p2 = __va_arg (argp, long long);
+    if (p1 != p2)
+      ret = 0;
+  } while (ret && p1 != 0);
+  CROSS_VA_END (argp_2);
+  return ret;
+}
+
+static
+int fct2 (int dummy, ...)
+{
+  va_list argp;
+  int ret = dummy;
+
+  __va_start (argp, dummy);
+  ret += fct1 (argp, SZ_ARGS);
+  __va_end (argp);
+  return ret;
+}
+
+int main()
+{
+  if (fct2 (-1, SZ_ARGS) != 0)
+    abort ();
+  return 0;
+}
--- gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-3.c.foo	2009-02-18 06:34:00.000000000 -0800
+++ gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-3.c	2009-02-18 06:33:01.000000000 -0800
@@ -0,0 +1,47 @@
+/* Test for cross x86_64<->w64 abi va_list calls.
+*/
+/* Origin: Kai Tietz <kai.tietz@onevision.com> */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+#include "callabi.h"
+
+extern void abort (void);
+
+#define SZ_ARGS	1ll,2ll,3ll,4ll,5ll,6ll,7ll,0ll
+
+static
+int fct1 (CROSS_VA_LIST argp, ...)
+{
+  long long p1,p2;
+  int ret = 1;
+  va_list argp_2;
+
+    __va_start (argp_2,argp);
+  do {
+    p1 = __va_arg (argp_2, long long);
+    p2 = CROSS_VA_ARG (argp, long long);
+    if (p1 != p2)
+      ret = 0;
+  } while (ret && p1 != 0);
+  __va_end (argp_2);
+  return ret;
+}
+
+static
+int CALLABI_CROSS fct2 (int dummy, ...)
+{
+  CROSS_VA_LIST argp;
+  int ret = dummy;
+
+  CROSS_VA_START (argp, dummy);
+  ret += fct1 (argp, SZ_ARGS);
+  CROSS_VA_END (argp);
+  return ret;
+}
+
+int main()
+{
+  if (fct2 (-1, SZ_ARGS) != 0)
+    abort ();
+  return 0;
+}


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