Skip to content

Commit

Permalink
Reduce_local test: Add feature test macros
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
devreal committed Jul 16, 2024
1 parent e132ccd commit 58dc607
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions test/datatype/reduce_local.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@
* 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
*
* $HEADER$
*/

/* needed for strsep() */
#define _DEFAULT_SOURCE
#define _BSD_SOURCE

/* needed for posix_memalign() and getopt() */
#define _POSIX_C_SOURCE 200809L

#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 58dc607

Please sign in to comment.