Skip to content

Commit 62f2e6f

Browse files
authored
Merge pull request #9702 from awlauria/compiler_and_ident_v5.0.x
v5.0.x: Compiler and ident cleanup
2 parents 2d2f3d5 + c48e267 commit 62f2e6f

27 files changed

+527
-1786
lines changed

config/opal_check_ident.m4

Lines changed: 0 additions & 101 deletions
This file was deleted.

configure.ac

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,10 +395,6 @@ AM_CONDITIONAL(OMPI_NEED_WINDOWS_REPLACEMENTS,
395395
# Do all Interix detections if necessary
396396
OMPI_INTERIX
397397

398-
# Does the compiler support "ident"-like constructs?
399-
400-
OPAL_CHECK_IDENT([CC], [CFLAGS], [c], [C])
401-
402398
#
403399
# Check for some types
404400
#

ompi/dpm/dpm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ static int dpm_convert(opal_list_t *infos,
685685
char *ck, *ptr, *help_str = NULL;
686686
int rc;
687687
char **tmp;
688-
dpm_conflicts_t *modifiers;
688+
dpm_conflicts_t *modifiers = NULL;
689689
const char *attr;
690690

691691
/* pick the modifiers to be checked */

ompi/errhandler/errhandler_predefined.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,11 @@ static void backend_abort_no_aggregate(int fatal, char *type,
403403

404404
len -= strlen(type);
405405
if (len > 0) {
406-
strncat(str, " ", len);
406+
strncat(str, " ", len - 1);
407407

408408
--len;
409409
if (len > 0) {
410-
strncat(str, name, len);
410+
strncat(str, name, len - 1);
411411
}
412412
}
413413
out("*** on %s", str);

ompi/include/ompi/constants.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ enum {
6262
OMPI_ERR_BUFFER = OPAL_ERR_BUFFER,
6363
OMPI_ERR_SILENT = OPAL_ERR_SILENT,
6464
OMPI_ERR_HANDLERS_COMPLETE = OPAL_ERR_HANDLERS_COMPLETE,
65+
OMPI_ERR_NOT_BOUND = OPAL_ERR_NOT_BOUND,
6566

6667
OMPI_ERR_REQUEST = OMPI_ERR_BASE - 1,
6768
OMPI_ERR_RMA_SYNC = OMPI_ERR_BASE - 2,

ompi/mca/hook/comm_method/hook_comm_method_fns.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,9 @@
2222
#include "ompi/mca/bml/base/base.h"
2323
#include "ompi/mca/mtl/base/base.h"
2424

25-
// In regular strncpy up to n bytes are copied, so if the 'to' buffer
26-
// was char string[16] and you called strncpy(string, , 16) you could
27-
// get 16 bytes of chars without a null. My preferred API is to let
28-
// n be the size of the buffer, and to let n-1 chars be copied, and
29-
// to guarantee null termination.
3025
static void
3126
mystrncpy(char *to, const char *from, int n) {
32-
strncpy(to, from, n-1);
33-
to[n-1] = 0;
27+
snprintf(to, n, "%s", from);
3428
}
3529

3630
// For converting comm_method strings to comm_method id# and back.

ompi/mca/osc/base/base.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ BEGIN_C_DECLS
3737
int ompi_osc_base_find_available(bool enable_progress_threads,
3838
bool enable_mpi_threads);
3939

40+
void ompi_osc_base_set_memory_alignment(struct opal_info_t *info,
41+
size_t *memory_alignment);
42+
4043
int ompi_osc_base_select(ompi_win_t *win,
4144
void **base,
4245
size_t size,

ompi/mca/osc/base/osc_base_frame.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "ompi/mca/mca.h"
2323
#include "opal/util/output.h"
2424
#include "opal/mca/base/base.h"
25-
25+
#include "opal/include/opal/align.h"
2626

2727
#include "ompi/mca/osc/osc.h"
2828
#include "ompi/mca/osc/base/base.h"
@@ -36,6 +36,24 @@
3636

3737
#include "ompi/mca/osc/base/static-components.h"
3838

39+
void
40+
ompi_osc_base_set_memory_alignment(struct opal_info_t *info,
41+
size_t *memory_alignment)
42+
{
43+
int flag;
44+
opal_cstring_t *align_info_str;
45+
46+
opal_info_get(info, "mpi_minimum_memory_alignment", &align_info_str, &flag);
47+
if (flag) {
48+
long long tmp_align = atoll(align_info_str->string);
49+
OBJ_RELEASE(align_info_str);
50+
if ((long long) OPAL_ALIGN_MIN < tmp_align) {
51+
*memory_alignment = tmp_align;
52+
}
53+
}
54+
}
55+
56+
3957
int
4058
ompi_osc_base_find_available(bool enable_progress_threads,
4159
bool enable_mpi_threads)

ompi/mca/osc/rdma/osc_rdma_component.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
#include "opal/util/arch.h"
4949
#include "opal/util/argv.h"
5050
#include "opal/util/printf.h"
51-
#include "opal/align.h"
5251
#include "opal/util/sys_limits.h"
5352
#if OPAL_CUDA_SUPPORT
5453
#include "opal/mca/common/cuda/common_cuda.h"
@@ -1321,8 +1320,6 @@ static int ompi_osc_rdma_component_select (struct ompi_win_t *win, void **base,
13211320
int world_size = ompi_comm_size (comm);
13221321
int init_limit = 256;
13231322
int ret;
1324-
int flag;
1325-
char infoval[32];
13261323
char *name;
13271324

13281325
/* the osc/sm component is the exclusive provider for support for shared
@@ -1363,15 +1360,7 @@ static int ompi_osc_rdma_component_select (struct ompi_win_t *win, void **base,
13631360
module->size = size;
13641361
module->memory_alignment = mca_osc_rdma_component.memory_alignment;
13651362
if (NULL != info) {
1366-
opal_cstring_t *align_info_str;
1367-
opal_info_get(info, "mpi_minimum_memory_alignment", &align_info_str, &flag);
1368-
if (flag) {
1369-
ssize_t tmp_align = atoll(align_info_str->string);
1370-
OBJ_RELEASE(align_info_str);
1371-
if (OPAL_ALIGN_MIN < tmp_align) {
1372-
module->memory_alignment = tmp_align;
1373-
}
1374-
}
1363+
ompi_osc_base_set_memory_alignment(info, &module->memory_alignment);
13751364
}
13761365

13771366
/* set the module so we properly cleanup */

ompi/mca/osc/sm/osc_sm_component.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "ompi/mca/osc/base/osc_base_obj_convert.h"
3030
#include "ompi/request/request.h"
3131
#include "opal/util/sys_limits.h"
32-
#include "opal/include/opal/align.h"
32+
#include "opal/align.h"
3333
#include "opal/util/info_subscriber.h"
3434
#include "opal/util/printf.h"
3535
#include "opal/mca/mpool/base/base.h"
@@ -196,7 +196,6 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit
196196
int comm_size = ompi_comm_size (comm);
197197
bool unlink_needed = false;
198198
int ret = OMPI_ERROR;
199-
int flag;
200199
size_t memory_alignment = OPAL_ALIGN_MIN;
201200

202201
if (OMPI_SUCCESS != (ret = check_win_ok(comm, flavor))) {
@@ -216,15 +215,7 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit
216215
if (OPAL_SUCCESS != ret) goto error;
217216

218217
if (NULL != info) {
219-
opal_cstring_t *align_info_str;
220-
ret = opal_info_get(info, "mpi_minimum_memory_alignment", &align_info_str, &flag);
221-
if (flag) {
222-
ssize_t tmp_align = atoll(align_info_str->string);
223-
OBJ_RELEASE(align_info_str);
224-
if (OPAL_ALIGN_MIN < tmp_align) {
225-
memory_alignment = tmp_align;
226-
}
227-
}
218+
ompi_osc_base_set_memory_alignment(info, &memory_alignment);
228219
}
229220

230221
/* fill in the function pointer part */

0 commit comments

Comments
 (0)