#include <stdarg.h>
|
#include <stdarg.h>
|
|
|
#include "compat-common.h"
|
#include "compat-common.h"
|
|
|
#define T(NAME, TYPE, INITVAL) \
|
#define T(NAME, TYPE, INITVAL) \
|
extern TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
|
extern TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
|
extern TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
|
extern TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
|
extern TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
|
extern TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
|
extern TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
|
extern TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
|
\
|
\
|
extern void check##NAME (TYPE x, TYPE v); \
|
extern void check##NAME (TYPE x, TYPE v); \
|
\
|
\
|
void \
|
void \
|
init##NAME (TYPE *p, TYPE v) \
|
init##NAME (TYPE *p, TYPE v) \
|
{ \
|
{ \
|
*p = v + INITVAL; \
|
*p = v + INITVAL; \
|
} \
|
} \
|
\
|
\
|
void \
|
void \
|
checkg##NAME (void) \
|
checkg##NAME (void) \
|
{ \
|
{ \
|
check##NAME (g01##NAME, 1+INITVAL); \
|
check##NAME (g01##NAME, 1+INITVAL); \
|
check##NAME (g02##NAME, 2+INITVAL); \
|
check##NAME (g02##NAME, 2+INITVAL); \
|
check##NAME (g03##NAME, 3+INITVAL); \
|
check##NAME (g03##NAME, 3+INITVAL); \
|
check##NAME (g04##NAME, 4+INITVAL); \
|
check##NAME (g04##NAME, 4+INITVAL); \
|
check##NAME (g05##NAME, 5+INITVAL); \
|
check##NAME (g05##NAME, 5+INITVAL); \
|
check##NAME (g06##NAME, 6+INITVAL); \
|
check##NAME (g06##NAME, 6+INITVAL); \
|
check##NAME (g07##NAME, 7+INITVAL); \
|
check##NAME (g07##NAME, 7+INITVAL); \
|
check##NAME (g08##NAME, 8+INITVAL); \
|
check##NAME (g08##NAME, 8+INITVAL); \
|
check##NAME (g09##NAME, 9+INITVAL); \
|
check##NAME (g09##NAME, 9+INITVAL); \
|
check##NAME (g10##NAME, 10+INITVAL); \
|
check##NAME (g10##NAME, 10+INITVAL); \
|
check##NAME (g11##NAME, 11+INITVAL); \
|
check##NAME (g11##NAME, 11+INITVAL); \
|
check##NAME (g12##NAME, 12+INITVAL); \
|
check##NAME (g12##NAME, 12+INITVAL); \
|
check##NAME (g13##NAME, 13+INITVAL); \
|
check##NAME (g13##NAME, 13+INITVAL); \
|
check##NAME (g14##NAME, 14+INITVAL); \
|
check##NAME (g14##NAME, 14+INITVAL); \
|
check##NAME (g15##NAME, 15+INITVAL); \
|
check##NAME (g15##NAME, 15+INITVAL); \
|
check##NAME (g16##NAME, 16+INITVAL); \
|
check##NAME (g16##NAME, 16+INITVAL); \
|
} \
|
} \
|
\
|
\
|
TYPE \
|
TYPE \
|
test0##NAME (void) \
|
test0##NAME (void) \
|
{ \
|
{ \
|
return g01##NAME; \
|
return g01##NAME; \
|
} \
|
} \
|
\
|
\
|
TYPE \
|
TYPE \
|
test1##NAME (TYPE x01) \
|
test1##NAME (TYPE x01) \
|
{ \
|
{ \
|
return x01; \
|
return x01; \
|
} \
|
} \
|
\
|
\
|
TYPE \
|
TYPE \
|
testva##NAME (int n, ...) \
|
testva##NAME (int n, ...) \
|
{ \
|
{ \
|
int i; \
|
int i; \
|
TYPE rslt; \
|
TYPE rslt; \
|
va_list ap; \
|
va_list ap; \
|
va_start (ap, n); \
|
va_start (ap, n); \
|
for (i = 0; i < n; i++) \
|
for (i = 0; i < n; i++) \
|
rslt = va_arg (ap, TYPE); \
|
rslt = va_arg (ap, TYPE); \
|
va_end (ap); \
|
va_end (ap); \
|
return rslt; \
|
return rslt; \
|
}
|
}
|
|
|
T(d32, _Decimal32, 1.2df)
|
T(d32, _Decimal32, 1.2df)
|
T(d64, _Decimal64, 12.34dd)
|
T(d64, _Decimal64, 12.34dd)
|
T(d128, _Decimal128, 123.456dl)
|
T(d128, _Decimal128, 123.456dl)
|
|
|