Skip to content

Commit 10dbb39

Browse files
alekswnj-xiong
authored andcommitted
[v2.3.x] fabtests/build: fix build issues for MacOS
Fixing warnings/errors from MacOS build Signed-off-by: Alexey Novikov <[email protected]> (cherry picked from commit e912b06)
1 parent dd929cc commit 10dbb39

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

fabtests/functional/rdm_stress.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
*/
2929

3030
#include <assert.h>
31+
#include <inttypes.h>
3132
#include <stdio.h>
3233
#include <stdlib.h>
3334
#include <getopt.h>
@@ -650,7 +651,7 @@ static bool get_uint64_val(const char *js, jsmntok_t *t, uint64_t *val)
650651
{
651652
if (t->type != JSMN_PRIMITIVE)
652653
return false;
653-
return (sscanf(&js[t->start], "%lu", val) == 1);
654+
return (sscanf(&js[t->start], "%" SCNu64, val) == 1);
654655
}
655656

656657
static bool get_op_enum(const char *js, jsmntok_t *t, uint32_t *op)

fabtests/multinode/src/timing.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,14 @@ void multi_timer_stop(struct multi_timer *timer)
5454
timer->end = ft_gettime_ns();
5555
}
5656

57+
#pragma GCC diagnostic push
58+
#pragma GCC diagnostic ignored "-Wunused-function"
5759
static inline void print_timer(struct multi_timer timer, char* info)
5860
{
5961
PRINTF("rank: %i, start: %ld, end: %ld, %s\n",
6062
timer.rank, timer.start, timer.end, info);
6163
}
64+
#pragma GCC diagnostic pop
6265

6366
int multi_timer_analyze(struct multi_timer *timers, int timer_count)
6467
{

fabtests/unit/mr_cache_evict.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ static int virt_to_phys(const void *va_addr, uint64_t *phy_addr)
132132
return ret;
133133
}
134134

135+
#pragma GCC diagnostic push
136+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
137+
135138
/* Sbrk/brk allocations are only intended to support a single outstanding
136139
* allocation at a time. Extra handling of the program break is needed to make
137140
* sbrk/brk allocations more flexible including making allocations thread safe.
@@ -192,7 +195,11 @@ static void brk_free(void *ptr)
192195
int ret;
193196

194197
FT_DEBUG("Resetting program break from %p to %p", cur_brk, rewind_brk);
198+
#ifndef __GLIBC__
199+
ret = (brk(rewind_brk) == (void*)-1) ? -1 : 0;
200+
#else
195201
ret = brk(rewind_brk);
202+
#endif
196203
if (ret) {
197204
FT_UNIT_STRERR(err_buf, "brk failed", -errno);
198205
return;
@@ -226,7 +233,11 @@ static void *brk_alloc(void)
226233
}
227234

228235
cur_brk = (void *) ((intptr_t) prev_brk + mr_buf_size);
236+
#ifndef __GLIBC__
237+
ret = (brk(cur_brk) == (void*)-1) ? -1 : 0;
238+
#else
229239
ret = brk(cur_brk);
240+
#endif
230241
if (ret) {
231242
FT_UNIT_STRERR(err_buf, "brk failed", -errno);
232243
return NULL;
@@ -246,6 +257,8 @@ static void *brk_alloc(void)
246257
return prev_brk;
247258
}
248259

260+
#pragma GCC diagnostic pop //-Wdeprecated-declarations
261+
249262
/* Mmap allocations are only intended to support a single outstanding
250263
* allocation at a time. Extra handling of the mmap reuse address needs to occur
251264
* to make mmap allocations more flexible including making allocations thread

0 commit comments

Comments
 (0)