scalar-by-value-3_main.c: New file.
* gcc.dg/compat/scalar-by-value-3_main.c: New file. * gcc.dg/compat/scalar-by-value-3_x.c: New file. * gcc.dg/compat/scalar-by-value-3_y.c: New file. * gcc.dg/compat/scalar-by-value-4_main.c: New file. * gcc.dg/compat/scalar-by-value-4_x.c: New file. * gcc.dg/compat/scalar-by-value-4_y.c: New file. * gcc.dg/compat/scalar-return-3_main.c: New file. * gcc.dg/compat/scalar-return-3_x.c: New file. * gcc.dg/compat/scalar-return-3_y.c: New file. * gcc.dg/compat/scalar-return-4_main.c: New file. * gcc.dg/compat/scalar-return-4_x.c: New file. * gcc.dg/compat/scalar-return-4_y.c: New file. From-SVN: r67789
This commit is contained in:
parent
e68b8bd0ff
commit
795a4ff2fa
@ -1,3 +1,18 @@
|
||||
2003-06-11 Janis Johnson <janis187@us.ibm.com>
|
||||
|
||||
* gcc.dg/compat/scalar-by-value-3_main.c: New file.
|
||||
* gcc.dg/compat/scalar-by-value-3_x.c: New file.
|
||||
* gcc.dg/compat/scalar-by-value-3_y.c: New file.
|
||||
* gcc.dg/compat/scalar-by-value-4_main.c: New file.
|
||||
* gcc.dg/compat/scalar-by-value-4_x.c: New file.
|
||||
* gcc.dg/compat/scalar-by-value-4_y.c: New file.
|
||||
* gcc.dg/compat/scalar-return-3_main.c: New file.
|
||||
* gcc.dg/compat/scalar-return-3_x.c: New file.
|
||||
* gcc.dg/compat/scalar-return-3_y.c: New file.
|
||||
* gcc.dg/compat/scalar-return-4_main.c: New file.
|
||||
* gcc.dg/compat/scalar-return-4_x.c: New file.
|
||||
* gcc.dg/compat/scalar-return-4_y.c: New file.
|
||||
|
||||
2003-06-10 Janis Johnson <janis187@us.ibm.com>
|
||||
|
||||
* gcc.dg/compat/fp2-struct-check.h: New file.
|
||||
|
14
gcc/testsuite/gcc.dg/compat/scalar-by-value-3_main.c
Normal file
14
gcc/testsuite/gcc.dg/compat/scalar-by-value-3_main.c
Normal file
@ -0,0 +1,14 @@
|
||||
/* Test passing scalars by value. This test includes _Complex types
|
||||
whose real and imaginary parts can be used in variable-length
|
||||
argument lists. */
|
||||
|
||||
extern void scalar_by_value_3_x (void);
|
||||
extern void exit (int);
|
||||
int fails;
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
scalar_by_value_3_x ();
|
||||
exit (0);
|
||||
}
|
170
gcc/testsuite/gcc.dg/compat/scalar-by-value-3_x.c
Normal file
170
gcc/testsuite/gcc.dg/compat/scalar-by-value-3_x.c
Normal file
@ -0,0 +1,170 @@
|
||||
#include "compat-common.h"
|
||||
|
||||
#define T(NAME, TYPE, INITVAL) \
|
||||
TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
|
||||
TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
|
||||
TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
|
||||
TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
|
||||
\
|
||||
extern void init##NAME (TYPE *p, TYPE v); \
|
||||
extern void checkg##NAME (void); \
|
||||
extern void \
|
||||
test##NAME (TYPE x01, TYPE x02, TYPE x03, TYPE x04, \
|
||||
TYPE x05, TYPE x06, TYPE x07, TYPE x08, \
|
||||
TYPE x09, TYPE x10, TYPE x11, TYPE x12, \
|
||||
TYPE x13, TYPE x14, TYPE x15, TYPE x16); \
|
||||
extern void testva##NAME (int n, ...); \
|
||||
\
|
||||
void \
|
||||
check##NAME (TYPE x, TYPE v) \
|
||||
{ \
|
||||
if (x != v + INITVAL) \
|
||||
DEBUG_CHECK \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
test2_##NAME (TYPE x01, TYPE x02, TYPE x03, TYPE x04, \
|
||||
TYPE x05, TYPE x06, TYPE x07, TYPE x08) \
|
||||
{ \
|
||||
test##NAME (x01, g02##NAME, x02, g04##NAME, \
|
||||
x03, g06##NAME, x04, g08##NAME, \
|
||||
x05, g10##NAME, x06, g12##NAME, \
|
||||
x07, g14##NAME, x08, g16##NAME); \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
testit##NAME (void) \
|
||||
{ \
|
||||
DEBUG_FPUTS (#NAME); \
|
||||
DEBUG_FPUTS (" init: "); \
|
||||
init##NAME (&g01##NAME, 1); \
|
||||
init##NAME (&g02##NAME, 2); \
|
||||
init##NAME (&g03##NAME, 3); \
|
||||
init##NAME (&g04##NAME, 4); \
|
||||
init##NAME (&g05##NAME, 5); \
|
||||
init##NAME (&g06##NAME, 6); \
|
||||
init##NAME (&g07##NAME, 7); \
|
||||
init##NAME (&g08##NAME, 8); \
|
||||
init##NAME (&g09##NAME, 9); \
|
||||
init##NAME (&g10##NAME, 10); \
|
||||
init##NAME (&g11##NAME, 11); \
|
||||
init##NAME (&g12##NAME, 12); \
|
||||
init##NAME (&g13##NAME, 13); \
|
||||
init##NAME (&g14##NAME, 14); \
|
||||
init##NAME (&g15##NAME, 15); \
|
||||
init##NAME (&g16##NAME, 16); \
|
||||
checkg##NAME (); \
|
||||
DEBUG_NL; \
|
||||
DEBUG_FPUTS (#NAME); \
|
||||
DEBUG_FPUTS (" test: "); \
|
||||
test##NAME (g01##NAME, g02##NAME, g03##NAME, g04##NAME, \
|
||||
g05##NAME, g06##NAME, g07##NAME, g08##NAME, \
|
||||
g09##NAME, g10##NAME, g11##NAME, g12##NAME, \
|
||||
g13##NAME, g14##NAME, g15##NAME, g16##NAME); \
|
||||
DEBUG_NL; \
|
||||
DEBUG_FPUTS (#NAME); \
|
||||
DEBUG_FPUTS (" testva:"); \
|
||||
DEBUG_NL; \
|
||||
testva##NAME (1, \
|
||||
g01##NAME); \
|
||||
DEBUG_NL; \
|
||||
testva##NAME (2, \
|
||||
g01##NAME, g02##NAME); \
|
||||
DEBUG_NL; \
|
||||
testva##NAME (3, \
|
||||
g01##NAME, g02##NAME, g03##NAME); \
|
||||
DEBUG_NL; \
|
||||
testva##NAME (4, \
|
||||
g01##NAME, g02##NAME, g03##NAME, g04##NAME); \
|
||||
DEBUG_NL; \
|
||||
testva##NAME (5, \
|
||||
g01##NAME, g02##NAME, g03##NAME, g04##NAME, \
|
||||
g05##NAME); \
|
||||
DEBUG_NL; \
|
||||
testva##NAME (6, \
|
||||
g01##NAME, g02##NAME, g03##NAME, g04##NAME, \
|
||||
g05##NAME, g06##NAME); \
|
||||
DEBUG_NL; \
|
||||
testva##NAME (7, \
|
||||
g01##NAME, g02##NAME, g03##NAME, g04##NAME, \
|
||||
g05##NAME, g06##NAME, g07##NAME); \
|
||||
DEBUG_NL; \
|
||||
testva##NAME (8, \
|
||||
g01##NAME, g02##NAME, g03##NAME, g04##NAME, \
|
||||
g05##NAME, g06##NAME, g07##NAME, g08##NAME); \
|
||||
DEBUG_NL; \
|
||||
testva##NAME (9, \
|
||||
g01##NAME, g02##NAME, g03##NAME, g04##NAME, \
|
||||
g05##NAME, g06##NAME, g07##NAME, g08##NAME, \
|
||||
g09##NAME); \
|
||||
DEBUG_NL; \
|
||||
testva##NAME (10, \
|
||||
g01##NAME, g02##NAME, g03##NAME, g04##NAME, \
|
||||
g05##NAME, g06##NAME, g07##NAME, g08##NAME, \
|
||||
g09##NAME, g10##NAME); \
|
||||
DEBUG_NL; \
|
||||
testva##NAME (11, \
|
||||
g01##NAME, g02##NAME, g03##NAME, g04##NAME, \
|
||||
g05##NAME, g06##NAME, g07##NAME, g08##NAME, \
|
||||
g09##NAME, g10##NAME, g11##NAME); \
|
||||
DEBUG_NL; \
|
||||
testva##NAME (12, \
|
||||
g01##NAME, g02##NAME, g03##NAME, g04##NAME, \
|
||||
g05##NAME, g06##NAME, g07##NAME, g08##NAME, \
|
||||
g09##NAME, g10##NAME, g11##NAME, g12##NAME); \
|
||||
DEBUG_NL; \
|
||||
testva##NAME (13, \
|
||||
g01##NAME, g02##NAME, g03##NAME, g04##NAME, \
|
||||
g05##NAME, g06##NAME, g07##NAME, g08##NAME, \
|
||||
g09##NAME, g10##NAME, g11##NAME, g12##NAME, \
|
||||
g13##NAME); \
|
||||
DEBUG_NL; \
|
||||
testva##NAME (14, \
|
||||
g01##NAME, g02##NAME, g03##NAME, g04##NAME, \
|
||||
g05##NAME, g06##NAME, g07##NAME, g08##NAME, \
|
||||
g09##NAME, g10##NAME, g11##NAME, g12##NAME, \
|
||||
g13##NAME, g14##NAME); \
|
||||
DEBUG_NL; \
|
||||
testva##NAME (15, \
|
||||
g01##NAME, g02##NAME, g03##NAME, g04##NAME, \
|
||||
g05##NAME, g06##NAME, g07##NAME, g08##NAME, \
|
||||
g09##NAME, g10##NAME, g11##NAME, g12##NAME, \
|
||||
g13##NAME, g14##NAME, g15##NAME); \
|
||||
DEBUG_NL; \
|
||||
testva##NAME (16, \
|
||||
g01##NAME, g02##NAME, g03##NAME, g04##NAME, \
|
||||
g05##NAME, g06##NAME, g07##NAME, g08##NAME, \
|
||||
g09##NAME, g10##NAME, g11##NAME, g12##NAME, \
|
||||
g13##NAME, g14##NAME, g15##NAME, g16##NAME); \
|
||||
DEBUG_NL; \
|
||||
DEBUG_FPUTS (#NAME); \
|
||||
DEBUG_FPUTS (" test2: "); \
|
||||
test2_##NAME (g01##NAME, g03##NAME, g05##NAME, g07##NAME, \
|
||||
g09##NAME, g11##NAME, g13##NAME, g15##NAME); \
|
||||
DEBUG_NL; \
|
||||
}
|
||||
|
||||
T(ci, _Complex int, (2,3))
|
||||
T(cl, _Complex long, (3,4))
|
||||
T(cll, _Complex long long, (5,6))
|
||||
T(cd, _Complex double, (7.0,8.0))
|
||||
T(cld, _Complex long double, (8.0,9.0))
|
||||
|
||||
#undef T
|
||||
|
||||
void
|
||||
scalar_by_value_3_x ()
|
||||
{
|
||||
#define T(NAME) testit##NAME ();
|
||||
|
||||
T(ci)
|
||||
T(cl)
|
||||
T(cll)
|
||||
T(cd)
|
||||
T(cld)
|
||||
|
||||
if (fails != 0)
|
||||
abort ();
|
||||
|
||||
#undef T
|
||||
}
|
92
gcc/testsuite/gcc.dg/compat/scalar-by-value-3_y.c
Normal file
92
gcc/testsuite/gcc.dg/compat/scalar-by-value-3_y.c
Normal file
@ -0,0 +1,92 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "compat-common.h"
|
||||
|
||||
/* Turn off checking for variable arguments with -DSKIPVA. */
|
||||
#ifdef SKIPVA
|
||||
const int test_va = 0;
|
||||
#else
|
||||
const int test_va = 1;
|
||||
#endif
|
||||
|
||||
#define T(NAME, TYPE, INITVAL) \
|
||||
extern TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
|
||||
extern TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
|
||||
extern TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
|
||||
extern TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
|
||||
\
|
||||
extern void check##NAME (TYPE x, TYPE v); \
|
||||
\
|
||||
void \
|
||||
init##NAME (TYPE *p, TYPE v) \
|
||||
{ \
|
||||
*p = v + INITVAL; \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
checkg##NAME (void) \
|
||||
{ \
|
||||
check##NAME (g01##NAME, 1); \
|
||||
check##NAME (g02##NAME, 2); \
|
||||
check##NAME (g03##NAME, 3); \
|
||||
check##NAME (g04##NAME, 4); \
|
||||
check##NAME (g05##NAME, 5); \
|
||||
check##NAME (g06##NAME, 6); \
|
||||
check##NAME (g07##NAME, 7); \
|
||||
check##NAME (g08##NAME, 8); \
|
||||
check##NAME (g09##NAME, 9); \
|
||||
check##NAME (g10##NAME, 10); \
|
||||
check##NAME (g11##NAME, 11); \
|
||||
check##NAME (g12##NAME, 12); \
|
||||
check##NAME (g13##NAME, 13); \
|
||||
check##NAME (g14##NAME, 14); \
|
||||
check##NAME (g15##NAME, 15); \
|
||||
check##NAME (g16##NAME, 16); \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
test##NAME (TYPE x01, TYPE x02, TYPE x03, TYPE x04, \
|
||||
TYPE x05, TYPE x06, TYPE x07, TYPE x08, \
|
||||
TYPE x09, TYPE x10, TYPE x11, TYPE x12, \
|
||||
TYPE x13, TYPE x14, TYPE x15, TYPE x16) \
|
||||
{ \
|
||||
check##NAME (x01, 1); \
|
||||
check##NAME (x02, 2); \
|
||||
check##NAME (x03, 3); \
|
||||
check##NAME (x04, 4); \
|
||||
check##NAME (x05, 5); \
|
||||
check##NAME (x06, 6); \
|
||||
check##NAME (x07, 7); \
|
||||
check##NAME (x08, 8); \
|
||||
check##NAME (x09, 9); \
|
||||
check##NAME (x10, 10); \
|
||||
check##NAME (x11, 11); \
|
||||
check##NAME (x12, 12); \
|
||||
check##NAME (x13, 13); \
|
||||
check##NAME (x14, 14); \
|
||||
check##NAME (x15, 15); \
|
||||
check##NAME (x16, 16); \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
testva##NAME (int n, ...) \
|
||||
{ \
|
||||
int i; \
|
||||
va_list ap; \
|
||||
if (test_va) \
|
||||
{ \
|
||||
va_start (ap, n); \
|
||||
for (i = 0; i < n; i++) \
|
||||
{ \
|
||||
TYPE t = va_arg (ap, TYPE); \
|
||||
check##NAME (t, i+1); \
|
||||
} \
|
||||
va_end (ap); \
|
||||
} \
|
||||
}
|
||||
|
||||
T(ci, _Complex int, (2,3))
|
||||
T(cl, _Complex long, (3,4))
|
||||
T(cll, _Complex long long, (5,6))
|
||||
T(cd, _Complex double, (7.0,8.0))
|
||||
T(cld, _Complex long double, (8.0,9.0))
|
14
gcc/testsuite/gcc.dg/compat/scalar-by-value-4_main.c
Normal file
14
gcc/testsuite/gcc.dg/compat/scalar-by-value-4_main.c
Normal file
@ -0,0 +1,14 @@
|
||||
/* Test passing scalars by value. This test includes _Complex types
|
||||
whose real and imaginary parts cannot be used in variable-length
|
||||
argument lists. */
|
||||
|
||||
extern void scalar_by_value_4_x (void);
|
||||
extern void exit (int);
|
||||
int fails;
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
scalar_by_value_4_x ();
|
||||
exit (0);
|
||||
}
|
90
gcc/testsuite/gcc.dg/compat/scalar-by-value-4_x.c
Normal file
90
gcc/testsuite/gcc.dg/compat/scalar-by-value-4_x.c
Normal file
@ -0,0 +1,90 @@
|
||||
#include "compat-common.h"
|
||||
|
||||
#define T(NAME, TYPE, INITVAL) \
|
||||
TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
|
||||
TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
|
||||
TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
|
||||
TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
|
||||
\
|
||||
extern void init##NAME (TYPE *p, TYPE v); \
|
||||
extern void checkg##NAME (void); \
|
||||
extern void \
|
||||
test##NAME (TYPE x01, TYPE x02, TYPE x03, TYPE x04, \
|
||||
TYPE x05, TYPE x06, TYPE x07, TYPE x08, \
|
||||
TYPE x09, TYPE x10, TYPE x11, TYPE x12, \
|
||||
TYPE x13, TYPE x14, TYPE x15, TYPE x16); \
|
||||
\
|
||||
void \
|
||||
check##NAME (TYPE x, TYPE v) \
|
||||
{ \
|
||||
if (x != v + INITVAL) \
|
||||
DEBUG_CHECK \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
test2_##NAME (TYPE x01, TYPE x02, TYPE x03, TYPE x04, \
|
||||
TYPE x05, TYPE x06, TYPE x07, TYPE x08) \
|
||||
{ \
|
||||
test##NAME (x01, g02##NAME, x02, g04##NAME, \
|
||||
x03, g06##NAME, x04, g08##NAME, \
|
||||
x05, g10##NAME, x06, g12##NAME, \
|
||||
x07, g14##NAME, x08, g16##NAME); \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
testit##NAME (void) \
|
||||
{ \
|
||||
DEBUG_FPUTS (#NAME); \
|
||||
DEBUG_FPUTS (" init: "); \
|
||||
init##NAME (&g01##NAME, 1); \
|
||||
init##NAME (&g02##NAME, 2); \
|
||||
init##NAME (&g03##NAME, 3); \
|
||||
init##NAME (&g04##NAME, 4); \
|
||||
init##NAME (&g05##NAME, 5); \
|
||||
init##NAME (&g06##NAME, 6); \
|
||||
init##NAME (&g07##NAME, 7); \
|
||||
init##NAME (&g08##NAME, 8); \
|
||||
init##NAME (&g09##NAME, 9); \
|
||||
init##NAME (&g10##NAME, 10); \
|
||||
init##NAME (&g11##NAME, 11); \
|
||||
init##NAME (&g12##NAME, 12); \
|
||||
init##NAME (&g13##NAME, 13); \
|
||||
init##NAME (&g14##NAME, 14); \
|
||||
init##NAME (&g15##NAME, 15); \
|
||||
init##NAME (&g16##NAME, 16); \
|
||||
checkg##NAME (); \
|
||||
DEBUG_NL; \
|
||||
DEBUG_FPUTS (#NAME); \
|
||||
DEBUG_FPUTS (" test: "); \
|
||||
test##NAME (g01##NAME, g02##NAME, g03##NAME, g04##NAME, \
|
||||
g05##NAME, g06##NAME, g07##NAME, g08##NAME, \
|
||||
g09##NAME, g10##NAME, g11##NAME, g12##NAME, \
|
||||
g13##NAME, g14##NAME, g15##NAME, g16##NAME); \
|
||||
DEBUG_NL; \
|
||||
DEBUG_FPUTS (#NAME); \
|
||||
DEBUG_FPUTS (" test2: "); \
|
||||
test2_##NAME (g01##NAME, g03##NAME, g05##NAME, g07##NAME, \
|
||||
g09##NAME, g11##NAME, g13##NAME, g15##NAME); \
|
||||
DEBUG_NL; \
|
||||
}
|
||||
|
||||
T(cc, _Complex char, (0,1))
|
||||
T(cs, _Complex short, (1,2))
|
||||
T(cf, _Complex float, (6.0,7.0))
|
||||
|
||||
#undef T
|
||||
|
||||
void
|
||||
scalar_by_value_4_x ()
|
||||
{
|
||||
#define T(NAME) testit##NAME ();
|
||||
|
||||
T(cc)
|
||||
T(cs)
|
||||
T(cf)
|
||||
|
||||
if (fails != 0)
|
||||
abort ();
|
||||
|
||||
#undef T
|
||||
}
|
73
gcc/testsuite/gcc.dg/compat/scalar-by-value-4_y.c
Normal file
73
gcc/testsuite/gcc.dg/compat/scalar-by-value-4_y.c
Normal file
@ -0,0 +1,73 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "compat-common.h"
|
||||
|
||||
/* Turn off checking for variable arguments with -DSKIPVA. */
|
||||
#ifdef SKIPVA
|
||||
const int test_va = 0;
|
||||
#else
|
||||
const int test_va = 1;
|
||||
#endif
|
||||
|
||||
#define T(NAME, TYPE, INITVAL) \
|
||||
extern TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
|
||||
extern TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
|
||||
extern TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
|
||||
extern TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
|
||||
\
|
||||
extern void check##NAME (TYPE x, TYPE v); \
|
||||
\
|
||||
void \
|
||||
init##NAME (TYPE *p, TYPE v) \
|
||||
{ \
|
||||
*p = v + INITVAL; \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
checkg##NAME (void) \
|
||||
{ \
|
||||
check##NAME (g01##NAME, 1); \
|
||||
check##NAME (g02##NAME, 2); \
|
||||
check##NAME (g03##NAME, 3); \
|
||||
check##NAME (g04##NAME, 4); \
|
||||
check##NAME (g05##NAME, 5); \
|
||||
check##NAME (g06##NAME, 6); \
|
||||
check##NAME (g07##NAME, 7); \
|
||||
check##NAME (g08##NAME, 8); \
|
||||
check##NAME (g09##NAME, 9); \
|
||||
check##NAME (g10##NAME, 10); \
|
||||
check##NAME (g11##NAME, 11); \
|
||||
check##NAME (g12##NAME, 12); \
|
||||
check##NAME (g13##NAME, 13); \
|
||||
check##NAME (g14##NAME, 14); \
|
||||
check##NAME (g15##NAME, 15); \
|
||||
check##NAME (g16##NAME, 16); \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
test##NAME (TYPE x01, TYPE x02, TYPE x03, TYPE x04, \
|
||||
TYPE x05, TYPE x06, TYPE x07, TYPE x08, \
|
||||
TYPE x09, TYPE x10, TYPE x11, TYPE x12, \
|
||||
TYPE x13, TYPE x14, TYPE x15, TYPE x16) \
|
||||
{ \
|
||||
check##NAME (x01, 1); \
|
||||
check##NAME (x02, 2); \
|
||||
check##NAME (x03, 3); \
|
||||
check##NAME (x04, 4); \
|
||||
check##NAME (x05, 5); \
|
||||
check##NAME (x06, 6); \
|
||||
check##NAME (x07, 7); \
|
||||
check##NAME (x08, 8); \
|
||||
check##NAME (x09, 9); \
|
||||
check##NAME (x10, 10); \
|
||||
check##NAME (x11, 11); \
|
||||
check##NAME (x12, 12); \
|
||||
check##NAME (x13, 13); \
|
||||
check##NAME (x14, 14); \
|
||||
check##NAME (x15, 15); \
|
||||
check##NAME (x16, 16); \
|
||||
}
|
||||
|
||||
T(cc, _Complex char, (0,1))
|
||||
T(cs, _Complex short, (1,2))
|
||||
T(cf, _Complex float, (6.0,7.0))
|
14
gcc/testsuite/gcc.dg/compat/scalar-return-3_main.c
Normal file
14
gcc/testsuite/gcc.dg/compat/scalar-return-3_main.c
Normal file
@ -0,0 +1,14 @@
|
||||
/* Test function return values. This test includes _Complex types
|
||||
whose real and imaginary parts can be used in variable-length
|
||||
argument lists. */
|
||||
|
||||
extern void scalar_return_3_x (void);
|
||||
extern void exit (int);
|
||||
int fails;
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
scalar_return_3_x ();
|
||||
exit (0);
|
||||
}
|
110
gcc/testsuite/gcc.dg/compat/scalar-return-3_x.c
Normal file
110
gcc/testsuite/gcc.dg/compat/scalar-return-3_x.c
Normal file
@ -0,0 +1,110 @@
|
||||
#include "compat-common.h"
|
||||
|
||||
/* Turn off checking for variable arguments with -DSKIPVA. */
|
||||
#ifdef SKIPVA
|
||||
const int test_va = 0;
|
||||
#else
|
||||
const int test_va = 1;
|
||||
#endif
|
||||
|
||||
#define T(NAME, TYPE, INITVAL) \
|
||||
TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
|
||||
TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
|
||||
TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
|
||||
TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
|
||||
\
|
||||
extern void init##NAME (TYPE *p, TYPE v); \
|
||||
extern void checkg##NAME (void); \
|
||||
extern TYPE test0##NAME (void); \
|
||||
extern TYPE test1##NAME (TYPE); \
|
||||
extern TYPE testva##NAME (int n, ...); \
|
||||
\
|
||||
void \
|
||||
check##NAME (TYPE x, TYPE v) \
|
||||
{ \
|
||||
if (x != v) \
|
||||
DEBUG_CHECK \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
testit##NAME (void) \
|
||||
{ \
|
||||
TYPE rslt; \
|
||||
DEBUG_FPUTS (#NAME); \
|
||||
DEBUG_FPUTS (" init: "); \
|
||||
init##NAME (&g01##NAME, 1); \
|
||||
init##NAME (&g02##NAME, 2); \
|
||||
init##NAME (&g03##NAME, 3); \
|
||||
init##NAME (&g04##NAME, 4); \
|
||||
init##NAME (&g05##NAME, 5); \
|
||||
init##NAME (&g06##NAME, 6); \
|
||||
init##NAME (&g07##NAME, 7); \
|
||||
init##NAME (&g08##NAME, 8); \
|
||||
init##NAME (&g09##NAME, 9); \
|
||||
init##NAME (&g10##NAME, 10); \
|
||||
init##NAME (&g11##NAME, 11); \
|
||||
init##NAME (&g12##NAME, 12); \
|
||||
init##NAME (&g13##NAME, 13); \
|
||||
init##NAME (&g14##NAME, 14); \
|
||||
init##NAME (&g15##NAME, 15); \
|
||||
init##NAME (&g16##NAME, 16); \
|
||||
checkg##NAME (); \
|
||||
DEBUG_NL; \
|
||||
DEBUG_FPUTS (#NAME); \
|
||||
DEBUG_FPUTS (" test0: "); \
|
||||
rslt = test0##NAME (); \
|
||||
check##NAME (rslt, g01##NAME); \
|
||||
DEBUG_NL; \
|
||||
DEBUG_FPUTS (#NAME); \
|
||||
DEBUG_FPUTS (" test1: "); \
|
||||
rslt = test1##NAME (g01##NAME); \
|
||||
check##NAME (rslt, g01##NAME); \
|
||||
if (test_va) \
|
||||
{ \
|
||||
DEBUG_NL; \
|
||||
DEBUG_FPUTS (#NAME); \
|
||||
DEBUG_FPUTS (" testva: "); \
|
||||
rslt = testva##NAME (1, g01##NAME); \
|
||||
check##NAME (rslt, g01##NAME); \
|
||||
rslt = testva##NAME (5, g01##NAME, g02##NAME, g03##NAME, \
|
||||
g04##NAME, g05##NAME); \
|
||||
check##NAME (rslt, g05##NAME); \
|
||||
rslt = testva##NAME (9, g01##NAME, g02##NAME, g03##NAME, \
|
||||
g04##NAME, g05##NAME, g06##NAME, \
|
||||
g07##NAME, g08##NAME, g09##NAME); \
|
||||
check##NAME (rslt, g09##NAME); \
|
||||
rslt = testva##NAME (16, g01##NAME, g02##NAME, g03##NAME, \
|
||||
g04##NAME, g05##NAME, g06##NAME, \
|
||||
g07##NAME, g08##NAME, g09##NAME, \
|
||||
g10##NAME, g11##NAME, g12##NAME, \
|
||||
g13##NAME, g14##NAME, g15##NAME, \
|
||||
g16##NAME); \
|
||||
check##NAME (rslt, g16##NAME); \
|
||||
} \
|
||||
DEBUG_NL; \
|
||||
}
|
||||
|
||||
T(ci, _Complex int, (2,3))
|
||||
T(cl, _Complex long, (3,4))
|
||||
T(cll, _Complex long long, (4,5))
|
||||
T(cd, _Complex double, (2.0,3.0))
|
||||
T(cld, _Complex long double, (3.0,4.0))
|
||||
|
||||
#undef T
|
||||
|
||||
void
|
||||
scalar_return_3_x ()
|
||||
{
|
||||
#define T(NAME) testit##NAME ();
|
||||
|
||||
T(ci)
|
||||
T(cl)
|
||||
T(cll)
|
||||
T(cd)
|
||||
T(cld)
|
||||
|
||||
if (fails != 0)
|
||||
abort ();
|
||||
|
||||
#undef T
|
||||
}
|
69
gcc/testsuite/gcc.dg/compat/scalar-return-3_y.c
Normal file
69
gcc/testsuite/gcc.dg/compat/scalar-return-3_y.c
Normal file
@ -0,0 +1,69 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "compat-common.h"
|
||||
|
||||
#define T(NAME, TYPE, INITVAL) \
|
||||
extern TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
|
||||
extern TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
|
||||
extern TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
|
||||
extern TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
|
||||
\
|
||||
extern void check##NAME (TYPE x, TYPE v); \
|
||||
\
|
||||
void \
|
||||
init##NAME (TYPE *p, TYPE v) \
|
||||
{ \
|
||||
*p = v + INITVAL; \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
checkg##NAME (void) \
|
||||
{ \
|
||||
check##NAME (g01##NAME, 1+INITVAL); \
|
||||
check##NAME (g02##NAME, 2+INITVAL); \
|
||||
check##NAME (g03##NAME, 3+INITVAL); \
|
||||
check##NAME (g04##NAME, 4+INITVAL); \
|
||||
check##NAME (g05##NAME, 5+INITVAL); \
|
||||
check##NAME (g06##NAME, 6+INITVAL); \
|
||||
check##NAME (g07##NAME, 7+INITVAL); \
|
||||
check##NAME (g08##NAME, 8+INITVAL); \
|
||||
check##NAME (g09##NAME, 9+INITVAL); \
|
||||
check##NAME (g10##NAME, 10+INITVAL); \
|
||||
check##NAME (g11##NAME, 11+INITVAL); \
|
||||
check##NAME (g12##NAME, 12+INITVAL); \
|
||||
check##NAME (g13##NAME, 13+INITVAL); \
|
||||
check##NAME (g14##NAME, 14+INITVAL); \
|
||||
check##NAME (g15##NAME, 15+INITVAL); \
|
||||
check##NAME (g16##NAME, 16+INITVAL); \
|
||||
} \
|
||||
\
|
||||
TYPE \
|
||||
test0##NAME (void) \
|
||||
{ \
|
||||
return g01##NAME; \
|
||||
} \
|
||||
\
|
||||
TYPE \
|
||||
test1##NAME (TYPE x01) \
|
||||
{ \
|
||||
return x01; \
|
||||
} \
|
||||
\
|
||||
TYPE \
|
||||
testva##NAME (int n, ...) \
|
||||
{ \
|
||||
int i; \
|
||||
TYPE rslt; \
|
||||
va_list ap; \
|
||||
va_start (ap, n); \
|
||||
for (i = 0; i < n; i++) \
|
||||
rslt = va_arg (ap, TYPE); \
|
||||
va_end (ap); \
|
||||
return rslt; \
|
||||
}
|
||||
|
||||
T(ci, _Complex int, (2,3))
|
||||
T(cl, _Complex long, (3,4))
|
||||
T(cll, _Complex long long, (4,5))
|
||||
T(cd, _Complex double, (2.0,3.0))
|
||||
T(cld, _Complex long double, (3.0,4.0))
|
14
gcc/testsuite/gcc.dg/compat/scalar-return-4_main.c
Normal file
14
gcc/testsuite/gcc.dg/compat/scalar-return-4_main.c
Normal file
@ -0,0 +1,14 @@
|
||||
/* Test function return values. This test includes _Complex types
|
||||
whose real and imaginary parts cannot be used in variable-length
|
||||
argument lists. */
|
||||
|
||||
extern void scalar_return_4_x (void);
|
||||
extern void exit (int);
|
||||
int fails;
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
scalar_return_4_x ();
|
||||
exit (0);
|
||||
}
|
58
gcc/testsuite/gcc.dg/compat/scalar-return-4_x.c
Normal file
58
gcc/testsuite/gcc.dg/compat/scalar-return-4_x.c
Normal file
@ -0,0 +1,58 @@
|
||||
#include "compat-common.h"
|
||||
|
||||
#define T(NAME, TYPE, INITVAL) \
|
||||
TYPE g01##NAME; \
|
||||
\
|
||||
extern void init##NAME (TYPE *p, TYPE v); \
|
||||
extern void checkg##NAME (void); \
|
||||
extern TYPE test0##NAME (void); \
|
||||
extern TYPE test1##NAME (TYPE); \
|
||||
\
|
||||
void \
|
||||
check##NAME (TYPE x, TYPE v) \
|
||||
{ \
|
||||
if (x != v) \
|
||||
DEBUG_CHECK \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
testit##NAME (void) \
|
||||
{ \
|
||||
TYPE rslt; \
|
||||
DEBUG_FPUTS (#NAME); \
|
||||
DEBUG_FPUTS (" init: "); \
|
||||
init##NAME (&g01##NAME, 1); \
|
||||
checkg##NAME (); \
|
||||
DEBUG_NL; \
|
||||
DEBUG_FPUTS (#NAME); \
|
||||
DEBUG_FPUTS (" test0: "); \
|
||||
rslt = test0##NAME (); \
|
||||
check##NAME (rslt, g01##NAME); \
|
||||
DEBUG_NL; \
|
||||
DEBUG_FPUTS (#NAME); \
|
||||
DEBUG_FPUTS (" test1: "); \
|
||||
rslt = test1##NAME (g01##NAME); \
|
||||
check##NAME (rslt, g01##NAME); \
|
||||
DEBUG_NL; \
|
||||
}
|
||||
|
||||
T(cc, _Complex char, (0,1))
|
||||
T(cs, _Complex short, (1,2))
|
||||
T(cf, _Complex float, (1.0,2.0))
|
||||
|
||||
#undef T
|
||||
|
||||
void
|
||||
scalar_return_4_x ()
|
||||
{
|
||||
#define T(NAME) testit##NAME ();
|
||||
|
||||
T(cc)
|
||||
T(cs)
|
||||
T(cf)
|
||||
|
||||
if (fails != 0)
|
||||
abort ();
|
||||
|
||||
#undef T
|
||||
}
|
43
gcc/testsuite/gcc.dg/compat/scalar-return-4_y.c
Normal file
43
gcc/testsuite/gcc.dg/compat/scalar-return-4_y.c
Normal file
@ -0,0 +1,43 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "compat-common.h"
|
||||
|
||||
/* Turn off checking for variable arguments with -DSKIPVA. */
|
||||
#ifdef SKIPVA
|
||||
const int test_va = 0;
|
||||
#else
|
||||
const int test_va = 1;
|
||||
#endif
|
||||
|
||||
#define T(NAME, TYPE, INITVAL) \
|
||||
extern TYPE g01##NAME; \
|
||||
\
|
||||
extern void check##NAME (TYPE x, TYPE v); \
|
||||
\
|
||||
void \
|
||||
init##NAME (TYPE *p, TYPE v) \
|
||||
{ \
|
||||
*p = v + INITVAL; \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
checkg##NAME (void) \
|
||||
{ \
|
||||
check##NAME (g01##NAME, 1+INITVAL); \
|
||||
} \
|
||||
\
|
||||
TYPE \
|
||||
test0##NAME (void) \
|
||||
{ \
|
||||
return g01##NAME; \
|
||||
} \
|
||||
\
|
||||
TYPE \
|
||||
test1##NAME (TYPE x01) \
|
||||
{ \
|
||||
return x01; \
|
||||
}
|
||||
|
||||
T(cc, _Complex char, (0,1))
|
||||
T(cs, _Complex short, (1,2))
|
||||
T(cf, _Complex float, (1.0,2.0))
|
Loading…
Reference in New Issue
Block a user