Skip to content

Commit

Permalink
BUILD: fix build with nvc
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergei-Lebedev committed Dec 5, 2024
1 parent 7f3c2f6 commit b3f943f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
12 changes: 9 additions & 3 deletions config/m4/configure.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# See file LICENSE for terms.
#

Expand Down Expand Up @@ -76,8 +76,14 @@ AC_ARG_ENABLE([debug],
AS_IF([test "x$enable_debug" = xyes],
[AS_MESSAGE([debug build])
AC_DEFINE([ENABLE_DEBUG], [1], [Enable debugging code])
CFLAGS="$CFLAGS -O0 -g3"
CXXFLAGS="$CXXFLAGS -O0 -g3"
# use -g3 if compiler supports it, otherwise just -g
CHECK_COMPILER_FLAG([-g3], [-g3],
[AC_LANG_SOURCE([[int main(int argc, char** argv){return 0;}]])],
[CFLAGS="$CFLAGS -O0 -g3"
CXXFLAGS="$CXXFLAGS -O0 -g3"],
[CFLAGS="$CFLAGS -O0 -g"
CXXFLAGS="$CXXFLAGS -O0 -g"])
AC_DEFINE([UCS_MAX_LOG_LEVEL], [UCS_LOG_LEVEL_TRACE_POLL], [Highest log level])],
[CFLAGS="$CFLAGS -O3 -g -DNDEBUG"
CXXFLAGS="$CXXFLAGS -O3 -g -DNDEBUG"
Expand Down
14 changes: 7 additions & 7 deletions src/utils/ucc_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -919,25 +919,25 @@ int ucc_config_sscanf_uint_ranged(const char *buf, void *dest,
return 0;
}

#define MAX_TMP_BUF_LENGTH 128
int ucc_config_sprintf_uint_ranged(char *buf, size_t max, const void *src,
const void *arg) // NOLINT
{
const ucc_mrange_uint_t *s = src;
const size_t tmp_max = 128;
ucc_mrange_t *r;
char tmp_start[tmp_max];
char tmp_end[tmp_max];
char tmp_mtypes[tmp_max];
char tmp_start[MAX_TMP_BUF_LENGTH];
char tmp_end[MAX_TMP_BUF_LENGTH];
char tmp_mtypes[MAX_TMP_BUF_LENGTH];
size_t last;

ucc_list_for_each(r, &s->ranges, list_elem) {
ucs_memunits_to_str(r->start, tmp_start, tmp_max);
ucs_memunits_to_str(r->end, tmp_end, tmp_max);
ucs_memunits_to_str(r->start, tmp_start, MAX_TMP_BUF_LENGTH);
ucs_memunits_to_str(r->end, tmp_end, MAX_TMP_BUF_LENGTH);
if (r->mtypes == UCC_MEM_TYPE_MASK_FULL) {
ucc_snprintf_safe(buf, max, "%s-%s:%u", tmp_start, tmp_end,
r->value);
} else {
ucc_mtype_map_to_str(r->mtypes, "^", tmp_mtypes, tmp_max);
ucc_mtype_map_to_str(r->mtypes, "^", tmp_mtypes, MAX_TMP_BUF_LENGTH);
ucc_snprintf_safe(buf, max, "%s-%s:%s:%u", tmp_start, tmp_end,
tmp_mtypes, r->value);
}
Expand Down

0 comments on commit b3f943f

Please sign in to comment.