scalar-by-value-4_x.c: Also test passing of variable arguments.

* gcc.dg/compat/scalar-by-value-4_x.c: Also test passing of
	variable arguments.
	* gcc.dg/compat/scalar-by-value-4_y.c (testva##NAME): New.
	* gcc.dg/compat/scalar-by-value-4_main.c: Update description comment.
	* gcc.dg/compat/scalar-return-4_x.c: Also test returning of
	variable argument.
	* gcc.dg/compat/scalar-return-4_y.c (testva##NAME): New.
	* gcc.dg/compat/scalar-return-4_main.c: Update description comment.

From-SVN: r240099
This commit is contained in:
Uros Bizjak 2016-09-12 22:32:17 +02:00 committed by Uros Bizjak
parent 54dcdb8895
commit e1d55bf787
7 changed files with 187 additions and 11 deletions

View file

@ -1,3 +1,14 @@
2016-09-12 Uros Bizjak <ubizjak@gmail.com>
* gcc.dg/compat/scalar-by-value-4_x.c: Also test passing of
variable arguments.
* gcc.dg/compat/scalar-by-value-4_y.c (testva##NAME): New.
* gcc.dg/compat/scalar-by-value-4_main.c: Update description comment.
* gcc.dg/compat/scalar-return-4_x.c: Also test returning of
variable argument.
* gcc.dg/compat/scalar-return-4_y.c (testva##NAME): New.
* gcc.dg/compat/scalar-return-4_main.c: Update description comment.
2016-09-12 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR c++/77496

View file

@ -1,5 +1,5 @@
/* Test passing scalars by value. This test includes _Complex types
whose real and imaginary parts cannot be used in variable-length
whose real and imaginary parts can be used in variable-length
argument lists. */
extern void scalar_by_value_4_x (void);

View file

@ -13,6 +13,7 @@ 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) \
@ -62,6 +63,81 @@ testit##NAME (void) \
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); \

View file

@ -65,6 +65,23 @@ test##NAME (TYPE x01, TYPE x02, TYPE x03, TYPE x04, \
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); \
} \
}
#ifndef SKIP_COMPLEX

View file

@ -1,5 +1,5 @@
/* Test function return values. This test includes _Complex types
whose real and imaginary parts cannot be used in variable-length
whose real and imaginary parts can be used in variable-length
argument lists. */
extern void scalar_return_4_x (void);

View file

@ -1,12 +1,22 @@
#include "compat-common.h"
#ifdef SKIP_VA
const int test_va = 0;
#else
const int test_va = 1;
#endif
#define T(NAME, TYPE, INITVAL) \
TYPE g01##NAME; \
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) \
@ -22,6 +32,21 @@ 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); \
@ -33,13 +58,35 @@ testit##NAME (void) \
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; \
}
#ifndef SKIP_COMPLEX
#ifndef SKIP_COMPLEX_INT
T(cc, _Complex char, CINT (0, 1))
T(cs, _Complex short, CINT (1 + 2))
T(cs, _Complex short, CINT (1, 2))
#endif
T(cf, _Complex float, CDBL (1.0, 2.0))
#endif

View file

@ -2,14 +2,11 @@
#include "compat-common.h"
#ifdef SKIP_VA
const int test_va = 0;
#else
const int test_va = 1;
#endif
#define T(NAME, TYPE, INITVAL) \
extern TYPE g01##NAME; \
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); \
\
@ -23,6 +20,21 @@ 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 \
@ -35,6 +47,19 @@ 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; \
}
#ifndef SKIP_COMPLEX