ref: 0b8249442ef12b7ea061ce15211991333baa4bee
parent: e86ddd562e89b044ecff8519f1e4f60372dcbd3e
author: Martin Storsjö <martin@martin.st>
date: Thu Aug 6 17:50:50 EDT 2020
checkasm: Enforce declare_func to be outside of check_func Move the declaration of func_ref/func_new into declare_func. This enforces that declare_func is a scope outside of/before check_func. This ensures that if the signal handler is triggered, we rewind to a scope outside of check_func, where check_func makes sure we don't rerun the test that just triggered the signal handler.
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -518,7 +518,6 @@
}
int main(int argc, char *argv[]) {
- (void)func_new, (void)func_ref;
state.seed = get_seed();
while (argc > 1) {
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -86,8 +86,6 @@
int float_near_abs_eps_array_ulp(const float *a, const float *b, float eps,
unsigned max_ulp, int len);
-static void *func_ref, *func_new;
-
#define BENCH_RUNS (1 << 12) /* Trade-off between accuracy and speed */
/* Decide whether or not the specified function needs to be tested */
@@ -99,6 +97,7 @@
* is optional. */
#define declare_func(ret, ...)\
declare_new(ret, __VA_ARGS__)\
+ void *func_ref, *func_new;\
typedef ret func_type(__VA_ARGS__);\
checkasm_save_context()