5 #define _CRT_SECURE_NO_WARNINGS
13 #pragma warning(disable : 4127)
14 #pragma warning(disable : 4820)
16 #if defined(__cplusplus) && (__cplusplus > 201100L)
17 #include <type_traits>
18 #endif /* __cplusplus */
19 #if A_PREREQ_GNUC(2, 95) || __has_warning("-Winline")
20 #pragma GCC diagnostic ignored "-Winline"
22 #if A_PREREQ_GNUC(2, 95) || __has_warning("-Wpadded")
23 #pragma GCC diagnostic ignored "-Wpadded"
25 #if A_PREREQ_GNUC(4, 6) || __has_warning("-Wdouble-promotion")
26 #if defined(A_FLOAT_TYPE) && (A_FLOAT_TYPE + 0 == A_FLOAT_SINGLE)
27 #pragma GCC diagnostic ignored "-Wdouble-promotion"
28 #endif /* A_FLOAT_TYPE + 0 == 0x04 */
29 #endif /* -Wdouble-promotion */
30 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ > 199900L) || \
31 defined(__cplusplus) && (__cplusplus > 201100L) || A_PREREQ_MSVC(19, 0)
38 #elif defined(_MSC_VER)
45 #else /* C < 199900 and C++ < 201100 */
46 #if LONG_MAX < INT64_MAX
57 #endif /* C > 199900 or C++ > 201100 */
59 #if A_FLOAT_TYPE + 0 == A_FLOAT_SINGLE
60 #define strtonum(string, endptr) strtof(string, endptr)
61 #elif A_FLOAT_TYPE + 0 == A_FLOAT_DOUBLE
62 #define strtonum(string, endptr) strtod(string, endptr)
63 #elif A_FLOAT_TYPE + 0 == A_FLOAT_EXTEND
64 #define strtonum(string, endptr) strtold(string, endptr)
65 #endif /* A_FLOAT_TYPE */
67 #define TEST_IS1(expression, message) \
71 (void)fprintf(stderr, "%s:%i:%s\n", __FILE__, __LINE__, message); \
75 #define TEST_IS0(expression, message) \
79 (void)fprintf(stderr, "%s:%i:%s\n", __FILE__, __LINE__, message); \
83 #define TEST_BUG(expression) TEST_IS1(expression, #expression)
86 #if defined(__cplusplus)
88 #endif /* __cplusplus */
89 int MAIN_(c
)(int argc
, char *argv
[]);
90 int MAIN_(x
)(int argc
, char *argv
[]);
91 int main_init(int argc
, char *argv
[], int arg1
);
92 int debug(char const *fmt
, ...) A_FORMAT(printf
, 1, 2);
93 #if defined(__cplusplus)
95 #define MAIN(argc, argv) MAIN_(x)(argc, argv)
96 #else /* !__cplusplus */
97 #define MAIN(argc, argv) MAIN_(c)(argc, argv)
98 #endif /* __cplusplus */
99 #if !defined __cplusplus
100 static void main_exit(void);
101 int main_init(int argc
, char *argv
[], int arg1
)
103 static FILE *out
= A_NULL
;
104 if (!out
&& argc
> arg1
)
106 out
= freopen(argv
[arg1
], "wb", stdout
);
107 if (out
) { arg1
= atexit(main_exit
); }
111 int main(int argc
, char *argv
[])
115 status
+= MAIN_(x
)(argc
, argv
);
117 status
+= MAIN_(c
)(argc
, argv
);
120 int debug(char const *fmt
, ...)
124 static void main_exit(void)
126 if (fclose(stdout
)) {}
128 #endif /* __cplusplus */
129 #if defined(HAS_CXX) == \
132 #endif /* __cplusplus */
135 #endif /* test/test.h */