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 #endif /* __cplusplus */
96 #if !defined __cplusplus
97 static void main_exit(void);
98 int main_init(int argc
, char *argv
[], int arg1
)
100 static FILE *out
= A_NULL
;
101 if (!out
&& argc
> arg1
)
103 out
= freopen(argv
[arg1
], "wb", stdout
);
104 if (out
) { arg1
= atexit(main_exit
); }
108 int main(int argc
, char *argv
[])
112 status
+= MAIN(_x
)(argc
, argv
);
114 status
+= MAIN(_c
)(argc
, argv
);
117 int debug(char const *fmt
, ...)
121 static void main_exit(void)
123 if (fclose(stdout
)) {}
125 #define main MAIN(_c)
126 #else /* !__cplusplus */
127 #define main MAIN(_x)
128 #endif /* __cplusplus */
129 #if defined(HAS_CXX) == \
132 #endif /* __cplusplus */
135 #endif /* test/test.h */