Skip to content

Commit 4e1e6f8

Browse files
authored
Merge pull request #6993 from awlauria/fix_warnings_master
Fix miscellaneous compiler warnings.
2 parents 096da7b + 0d4004c commit 4e1e6f8

File tree

7 files changed

+50
-31
lines changed

7 files changed

+50
-31
lines changed

ompi/mca/topo/treematch/treematch/tm_mapping.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,7 @@ static long int init_mat_mmap(char *filename,int N, double **mat, double *sum_ro
247247
return nnz;
248248
}
249249

250-
251-
252-
250+
#ifdef __MACH__
253251
static long int init_mat_long(char *filename,int N, double **mat, double *sum_row){
254252
int i;
255253
unsigned int vl = tm_get_verbose_level();
@@ -275,7 +273,7 @@ static long int init_mat_long(char *filename,int N, double **mat, double *sum_ro
275273
fclose (pf);
276274
return nnz;
277275
}
278-
276+
#endif
279277

280278
tm_affinity_mat_t * new_affinity_mat(double **mat, double *sum_row, int order, long int nnz){
281279
tm_affinity_mat_t * aff_mat;

opal/datatype/opal_convertor_raw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ opal_convertor_merge_iov( struct iovec* iov, uint32_t* iov_count,
4141
uint32_t* idx )
4242
{
4343
if( 0 != iov[*idx].iov_len ) {
44-
if( (base == ((char*)iov[*idx].iov_base + iov[*idx].iov_len)) ) {
44+
if( base == ((char*)iov[*idx].iov_base + iov[*idx].iov_len) ) {
4545
iov[*idx].iov_len += len; /* merge with previous iovec */
4646
return 0;
4747
} /* cannot merge, move to the next position */

opal/datatype/opal_copy_functions_heterogeneous.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,14 @@ struct bit80 {
8989
static inline void
9090
opal_dt_swap_long_double(void *to_p, const void *from_p, const size_t size, size_t count, uint32_t remoteArch)
9191
{
92+
9293
#ifdef HAVE_IEEE754_H
93-
size_t i;
94-
long double*to = (long double *) to_p;
9594

9695
if ((opal_local_arch&OPAL_ARCH_LDISINTEL) && !(remoteArch&OPAL_ARCH_LDISINTEL)) {
9796
#ifdef __x86_64
98-
for (i=0; i<count; i++, to++) {
97+
long double*to = (long double *) to_p;
98+
99+
for (size_t i=0; i<count; i++, to++) {
99100
union ieee854_long_double ld;
100101
struct bit128 * b = (struct bit128 *)to;
101102
ld.ieee.empty = 0;
@@ -108,7 +109,9 @@ opal_dt_swap_long_double(void *to_p, const void *from_p, const size_t size, size
108109
#endif
109110
} else if (!(opal_local_arch&OPAL_ARCH_LDISINTEL) && (remoteArch&OPAL_ARCH_LDISINTEL)) {
110111
#ifdef __sparcv9
111-
for (i=0; i<count; i++, to++) {
112+
long double*to = (long double *) to_p;
113+
114+
for (size_t i=0; i<count; i++, to++) {
112115
union ieee854_long_double ld;
113116
struct bit80 * b = (struct bit80 *)to;
114117
ld.ieee.mantissa3 = 0;

opal/mca/btl/tcp/btl_tcp_addr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct mca_btl_tcp_addr_t {
6868
#if OPAL_ENABLE_IPV6
6969
struct in6_addr addr_inet6; /* IPv6 listen address */
7070
#endif
71-
};
71+
} addr_union;
7272
in_port_t addr_port; /**< listen port */
7373
int addr_ifkindex; /**< remote interface index assigned with
7474
this address */

opal/mca/btl/tcp/btl_tcp_proc.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,15 @@ mca_btl_tcp_proc_t* mca_btl_tcp_proc_create(opal_proc_t* proc)
172172
fields needed in the proc version */
173173
for (i = 0 ; i < btl_proc->proc_addr_count ; i++) {
174174
if (MCA_BTL_TCP_AF_INET == remote_addrs[i].addr_family) {
175-
memcpy(&btl_proc->proc_addrs[i].addr_inet,
175+
memcpy(&btl_proc->proc_addrs[i].addr_union.addr_inet,
176176
remote_addrs[i].addr, sizeof(struct in_addr));
177177
btl_proc->proc_addrs[i].addr_port = remote_addrs[i].addr_port;
178178
btl_proc->proc_addrs[i].addr_ifkindex = remote_addrs[i].addr_ifkindex;
179179
btl_proc->proc_addrs[i].addr_family = AF_INET;
180180
btl_proc->proc_addrs[i].addr_inuse = false;
181181
} else if (MCA_BTL_TCP_AF_INET6 == remote_addrs[i].addr_family) {
182182
#if OPAL_ENABLE_IPV6
183-
memcpy(&btl_proc->proc_addrs[i].addr_inet6,
183+
memcpy(&btl_proc->proc_addrs[i].addr_union.addr_inet6,
184184
remote_addrs[i].addr, sizeof(struct in6_addr));
185185
btl_proc->proc_addrs[i].addr_port = remote_addrs[i].addr_port;
186186
btl_proc->proc_addrs[i].addr_ifkindex = remote_addrs[i].addr_ifkindex;
@@ -869,7 +869,7 @@ void mca_btl_tcp_proc_accept(mca_btl_tcp_proc_t* btl_proc, struct sockaddr* addr
869869
}
870870
switch (addr->sa_family) {
871871
case AF_INET:
872-
if( memcmp( &btl_endpoint->endpoint_addr->addr_inet,
872+
if( memcmp( &btl_endpoint->endpoint_addr->addr_union.addr_inet,
873873
&(((struct sockaddr_in*)addr)->sin_addr),
874874
sizeof(struct in_addr) ) ) {
875875
char tmp[2][16];
@@ -878,7 +878,7 @@ void mca_btl_tcp_proc_accept(mca_btl_tcp_proc_t* btl_proc, struct sockaddr* addr
878878
OPAL_NAME_PRINT(btl_proc->proc_opal->proc_name),
879879
inet_ntop(AF_INET, (void*)&((struct sockaddr_in*)addr)->sin_addr,
880880
tmp[0], 16),
881-
inet_ntop(AF_INET, (void*)(struct in_addr*)&btl_endpoint->endpoint_addr->addr_inet,
881+
inet_ntop(AF_INET, (void*)(struct in_addr*)&btl_endpoint->endpoint_addr->addr_union.addr_inet,
882882
tmp[1], 16),
883883
(int)i, (int)btl_proc->proc_endpoint_count);
884884
continue;
@@ -890,7 +890,7 @@ void mca_btl_tcp_proc_accept(mca_btl_tcp_proc_t* btl_proc, struct sockaddr* addr
890890
break;
891891
#if OPAL_ENABLE_IPV6
892892
case AF_INET6:
893-
if( memcmp( &btl_endpoint->endpoint_addr->addr_inet,
893+
if( memcmp( &btl_endpoint->endpoint_addr->addr_union.addr_inet,
894894
&(((struct sockaddr_in6*)addr)->sin6_addr),
895895
sizeof(struct in6_addr) ) ) {
896896
char tmp[2][INET6_ADDRSTRLEN];
@@ -899,7 +899,7 @@ void mca_btl_tcp_proc_accept(mca_btl_tcp_proc_t* btl_proc, struct sockaddr* addr
899899
OPAL_NAME_PRINT(btl_proc->proc_opal->proc_name),
900900
inet_ntop(AF_INET6, (void*)&((struct sockaddr_in6*)addr)->sin6_addr,
901901
tmp[0], INET6_ADDRSTRLEN),
902-
inet_ntop(AF_INET6, (void*)(struct in6_addr*)&btl_endpoint->endpoint_addr->addr_inet,
902+
inet_ntop(AF_INET6, (void*)(struct in6_addr*)&btl_endpoint->endpoint_addr->addr_union.addr_inet,
903903
tmp[1], INET6_ADDRSTRLEN),
904904
(int)i, (int)btl_proc->proc_endpoint_count);
905905
continue;
@@ -941,7 +941,7 @@ void mca_btl_tcp_proc_accept(mca_btl_tcp_proc_t* btl_proc, struct sockaddr* addr
941941
continue;
942942
}
943943
inet_ntop(btl_endpoint->endpoint_addr->addr_family,
944-
(void*) &(btl_endpoint->endpoint_addr->addr_inet),
944+
(void*) &(btl_endpoint->endpoint_addr->addr_union.addr_inet),
945945
ip, sizeof(ip) - 1);
946946
if (NULL == addr_str) {
947947
opal_asprintf(&tmp, "\n\t%s", ip);
@@ -978,16 +978,16 @@ bool mca_btl_tcp_proc_tosocks(mca_btl_tcp_addr_t* proc_addr,
978978
case AF_INET:
979979
output->ss_family = AF_INET;
980980
memcpy(&((struct sockaddr_in*)output)->sin_addr,
981-
&proc_addr->addr_inet, sizeof(struct in_addr));
981+
&proc_addr->addr_union.addr_inet, sizeof(struct in_addr));
982982
((struct sockaddr_in*)output)->sin_port = proc_addr->addr_port;
983983
break;
984984
#if OPAL_ENABLE_IPV6
985985
case AF_INET6:
986986
{
987987
struct sockaddr_in6* inaddr = (struct sockaddr_in6*)output;
988988
output->ss_family = AF_INET6;
989-
memcpy(&inaddr->sin6_addr, &proc_addr->addr_inet,
990-
sizeof (proc_addr->addr_inet));
989+
memcpy(&inaddr->sin6_addr, &proc_addr->addr_union.addr_inet,
990+
sizeof (proc_addr->addr_union.addr_inet));
991991
inaddr->sin6_port = proc_addr->addr_port;
992992
inaddr->sin6_scope_id = 0;
993993
inaddr->sin6_flowinfo = 0;

opal/mca/memory/patcher/memory_patcher_component.c

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,20 @@ static int intercept_brk (void *addr)
334334

335335
#endif
336336

337-
#define HAS_SHMDT (defined(SYS_shmdt) || \
338-
(defined(IPCOP_shmdt) && defined(SYS_ipc)))
339-
#define HAS_SHMAT (defined(SYS_shmat) || \
340-
(defined(IPCOP_shmat) && defined(SYS_ipc)))
337+
#if defined(SYS_shmdt) || (defined(IPCOP_shmdt) && defined(SYS_ipc))
338+
#define HAS_SHMDT 1
339+
#else
340+
#define HAS_SHMDT 0
341+
#endif
342+
343+
#if defined(SYS_shmat) ||(defined(IPCOP_shmat) && defined(SYS_ipc))
344+
#define HAS_SHMAT 1
345+
#else
346+
#define HAS_SHMAT 0
347+
#endif
341348

342-
#if (HAS_SHMDT || HAS_SHMAT) && defined(__linux__)
349+
#if HAS_SHMDT || HAS_SHMAT
350+
#if defined(__linux__)
343351

344352
#include <stdio.h>
345353
#include <fcntl.h>
@@ -415,8 +423,10 @@ static size_t get_shm_size(int shmid)
415423
return ds.shm_segsz;
416424
}
417425
#endif
426+
#endif
418427

419-
#if HAS_SHMAT && defined(__linux__)
428+
#if HAS_SHMAT
429+
#if defined(__linux__)
420430
static void *(*original_shmat)(int shmid, const void *shmaddr, int shmflg);
421431

422432
static void *_intercept_shmat(int shmid, const void *shmaddr, int shmflg)
@@ -462,8 +472,10 @@ static void* intercept_shmat (int shmid, const void * shmaddr, int shmflg)
462472
return result;
463473
}
464474
#endif
475+
#endif
465476

466-
#if HAS_SHMDT && defined(__linux__)
477+
#if HAS_SHMDT
478+
#if defined(__linux__)
467479
static int (*original_shmdt) (const void *);
468480

469481
static int _intercept_shmdt (const void *shmaddr)
@@ -495,6 +507,7 @@ static int intercept_shmdt (const void *shmaddr)
495507
return result;
496508
}
497509
#endif
510+
#endif
498511

499512
static int patcher_register (void)
500513
{
@@ -570,19 +583,23 @@ static int patcher_open (void)
570583
}
571584
#endif
572585

573-
#if HAS_SHMAT && defined(__linux__)
586+
#if HAS_SHMAT
587+
#if defined(__linux__)
574588
rc = opal_patcher->patch_symbol ("shmat", (uintptr_t) intercept_shmat, (uintptr_t *) &original_shmat);
575589
if (OPAL_SUCCESS != rc) {
576590
return rc;
577591
}
578592
#endif
593+
#endif
579594

580-
#if HAS_SHMDT && defined(__linux__)
595+
#if defined(__linux__)
596+
#if HAS_SHMDT
581597
rc = opal_patcher->patch_symbol ("shmdt", (uintptr_t) intercept_shmdt, (uintptr_t *) &original_shmdt);
582598
if (OPAL_SUCCESS != rc) {
583599
return rc;
584600
}
585601
#endif
602+
#endif
586603

587604
#if defined (SYS_brk)
588605
rc = opal_patcher->patch_symbol ("brk", (uintptr_t)intercept_brk, (uintptr_t *) &original_brk);

opal/util/malloc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@ int opal_malloc_debug_level = OPAL_MALLOC_DEBUG_LEVEL;
5252
int opal_malloc_output = -1;
5353

5454

55+
56+
#if OPAL_ENABLE_DEBUG
57+
5558
/*
5659
* Private variables
5760
*/
5861
static opal_output_stream_t malloc_stream;
5962

60-
61-
#if OPAL_ENABLE_DEBUG
6263
/*
6364
* Finalize the malloc debug interface
6465
*/

0 commit comments

Comments
 (0)