5 #define _CRT_SECURE_NO_WARNINGS
12 #pragma warning(disable : 4127)
13 #pragma warning(disable : 4820)
15 #if defined(__cplusplus) && (__cplusplus > 201100L)
16 #include <type_traits>
17 #endif /* __cplusplus */
18 #if A_PREREQ_GNUC(2, 95) || __has_warning("-Winline")
19 #pragma GCC diagnostic ignored "-Winline"
21 #if A_PREREQ_GNUC(2, 95) || __has_warning("-Wpadded")
22 #pragma GCC diagnostic ignored "-Wpadded"
24 #if A_PREREQ_GNUC(4, 6) || __has_warning("-Wdouble-promotion")
25 #if defined(A_FLOAT_TYPE) && (A_FLOAT_TYPE + 0 == A_FLOAT_SINGLE)
26 #pragma GCC diagnostic ignored "-Wdouble-promotion"
27 #endif /* A_FLOAT_TYPE + 0 == 0x04 */
28 #endif /* -Wdouble-promotion */
29 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ > 199900L) || \
30 defined(__cplusplus) && (__cplusplus > 201100L) || A_PREREQ_MSVC(19, 0)
37 #elif defined(_MSC_VER)
44 #else /* C < 199900 and C++ < 201100 */
45 #if LONG_MAX == INT32_MAX
56 #endif /* C > 199900 or C++ > 201100 */
58 #if A_FLOAT_TYPE + 0 == A_FLOAT_SINGLE
59 #define strtonum(string, endptr) strtof(string, endptr)
60 #elif A_FLOAT_TYPE + 0 == A_FLOAT_DOUBLE
61 #define strtonum(string, endptr) strtod(string, endptr)
62 #elif A_FLOAT_TYPE + 0 == A_FLOAT_EXTEND
63 #define strtonum(string, endptr) strtold(string, endptr)
64 #endif /* A_FLOAT_TYPE */
66 #define TEST_IS1(expression, message) \
70 (void)fprintf(stderr, "%s:%i:%s\n", __FILE__, __LINE__, message); \
74 #define TEST_IS0(expression, message) \
78 (void)fprintf(stderr, "%s:%i:%s\n", __FILE__, __LINE__, message); \
82 #define TEST_BUG(expression) TEST_IS1(expression, #expression)
85 #if defined(__cplusplus)
87 #endif /* __cplusplus */
88 int MAIN(_c
)(int argc
, char *argv
[]);
89 int MAIN(_x
)(int argc
, char *argv
[]);
90 int main_init(int argc
, char *argv
[], int arg1
);
91 int debug(char const *fmt
, ...) A_FORMAT(printf
, 1, 2);
92 #if defined(__cplusplus)
94 #endif /* __cplusplus */
95 #if !defined __cplusplus
96 static void main_exit(void);
97 int main_init(int argc
, char *argv
[], int arg1
)
99 static FILE *out
= A_NULL
;
100 if (!out
&& argc
> arg1
)
102 out
= freopen(argv
[arg1
], "wb", stdout
);
103 if (out
) { arg1
= atexit(main_exit
); }
107 int main(int argc
, char *argv
[])
111 status
+= MAIN(_x
)(argc
, argv
);
113 status
+= MAIN(_c
)(argc
, argv
);
116 int debug(char const *fmt
, ...)
120 static void main_exit(void)
122 if (fclose(stdout
)) {}
124 #define main MAIN(_c)
125 #else /* !__cplusplus */
126 #define main MAIN(_x)
127 #endif /* __cplusplus */
128 #if defined(HAS_CXX) == \
131 #endif /* __cplusplus */
134 #endif /* test/test.h */