Skip to content

Commit f925b01

Browse files
committed
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 <[email protected]>
1 parent bd92bf0 commit f925b01

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

test/datatype/reduce_local.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,21 @@
55
* reserved.
66
* Copyright (c) 2020 Research Organization for Information Science
77
* and Technology (RIST). All rights reserved.
8+
* Copyright (c) 2024 Stony Brook University. All rights reserved.
89
* $COPYRIGHT$
910
*
1011
* Additional copyrights may follow
1112
*
1213
* $HEADER$
1314
*/
1415

16+
/* needed for strsep() */
17+
#define _DEFAULT_SOURCE
18+
#define _BSD_SOURCE
19+
20+
/* needed for posix_memalign() and getopt() */
21+
#define _POSIX_C_SOURCE 200809L
22+
1523
#include <stdbool.h>
1624
#include <stdint.h>
1725
#include <stdio.h>
@@ -50,19 +58,9 @@ static int do_ops[12] = {
5058
static int verbose = 0;
5159
static int total_errors = 0;
5260

53-
#define max(a, b) \
54-
({ \
55-
__typeof__(a) _a = (a); \
56-
__typeof__(b) _b = (b); \
57-
_a > _b ? _a : _b; \
58-
})
59-
60-
#define min(a, b) \
61-
({ \
62-
__typeof__(a) _a = (a); \
63-
__typeof__(b) _b = (b); \
64-
_a < _b ? _a : _b; \
65-
})
61+
#define max(a, b) (a) > (b) ? (a) : (b)
62+
63+
#define min(a, b) (a) < (b) ? (a) : (b)
6664

6765
static void print_status(char *op, char *type, int type_size, int count, int max_shift,
6866
double *duration, int repeats, int correct)

0 commit comments

Comments
 (0)