From 58dc607d4b54804c01e8492cd99d86ecacc43952 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Thu, 11 Jul 2024 09:43:00 -0400 Subject: [PATCH] Reduce_local test: Add feature test macros Needed for strsep(), posix_memalign(), and getopt(). Also fix the min/max macros. There is no need to cache the variables as these macros are used without producing side-effects. Signed-off-by: Joseph Schuchart --- test/datatype/reduce_local.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/test/datatype/reduce_local.c b/test/datatype/reduce_local.c index 9a428f35670..baa14310c50 100644 --- a/test/datatype/reduce_local.c +++ b/test/datatype/reduce_local.c @@ -5,6 +5,7 @@ * reserved. * Copyright (c) 2020 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2024 Stony Brook University. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -12,6 +13,13 @@ * $HEADER$ */ +/* needed for strsep() */ +#define _DEFAULT_SOURCE +#define _BSD_SOURCE + +/* needed for posix_memalign() and getopt() */ +#define _POSIX_C_SOURCE 200809L + #include #include #include @@ -50,19 +58,9 @@ static int do_ops[12] = { static int verbose = 0; static int total_errors = 0; -#define max(a, b) \ - ({ \ - __typeof__(a) _a = (a); \ - __typeof__(b) _b = (b); \ - _a > _b ? _a : _b; \ - }) - -#define min(a, b) \ - ({ \ - __typeof__(a) _a = (a); \ - __typeof__(b) _b = (b); \ - _a < _b ? _a : _b; \ - }) +#define max(a, b) (a) > (b) ? (a) : (b) + +#define min(a, b) (a) < (b) ? (a) : (b) static void print_status(char *op, char *type, int type_size, int count, int max_shift, double *duration, int repeats, int correct)