Skip to content

Commit 8af45b8

Browse files
committed
Fix most compile warns when compiled with -Wall.
1 parent 356524d commit 8af45b8

File tree

1 file changed

+12
-46
lines changed

1 file changed

+12
-46
lines changed

src/runtime-libraries/mpi/mpi_caf.c

Lines changed: 12 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,11 +1048,6 @@ communication_thread(void *)
10481048
static void
10491049
unsupported_fail_images_message(const char *functionname);
10501050

1051-
/* Forward declaration of the feature unimplemented message for allocatable
1052-
* components. */
1053-
static void
1054-
unimplemented_alloc_comps_message(const char *functionname);
1055-
10561051
static void
10571052
locking_atomic_op(MPI_Win win, int *value, int newval, int compare,
10581053
int image_index, size_t index)
@@ -1379,7 +1374,8 @@ mutex_unlock(MPI_Win win, int image_index, size_t index, int *stat,
13791374
if (stat != NULL)
13801375
*stat = 0;
13811376
#if MPI_VERSION >= 3
1382-
int value = 1, ierr = 0, newval = 0, flag;
1377+
/* Mark `flag` unused, because of conditional compilation. */
1378+
int value = 1, ierr = 0, newval = 0, flag __attribute__((unused));
13831379
#ifdef WITH_FAILED_IMAGES
13841380
ierr = MPI_Test(&alive_request, &flag, MPI_STATUS_IGNORE);
13851381
chk_err(ierr);
@@ -1392,9 +1388,8 @@ mutex_unlock(MPI_Win win, int image_index, size_t index, int *stat,
13921388
ierr = CAF_Win_unlock(image_index - 1, win);
13931389
chk_err(ierr);
13941390

1395-
/* Temporarily commented */
1396-
/* if (value == 0)
1397-
* goto stat_error; */
1391+
if (value == 0)
1392+
goto stat_error;
13981393

13991394
if (stat)
14001395
*stat = ierr;
@@ -1429,7 +1424,8 @@ PREFIX(init)(int *argc, char ***argv)
14291424
int flag;
14301425
if (caf_num_images == 0)
14311426
{
1432-
int ierr = 0, i = 0, j = 0, rc, prov_lev = 0;
1427+
/* Flag rc as unused, because conditional compilation. */
1428+
int ierr = 0, i = 0, j = 0, rc __attribute__((unused)), prov_lev = 0;
14331429
int is_init = 0, prior_thread_level = MPI_THREAD_MULTIPLE;
14341430
ierr = MPI_Initialized(&is_init);
14351431
chk_err(ierr);
@@ -7462,8 +7458,6 @@ PREFIX(send_by_ref)(caf_token_t token, int image_index, gfc_descriptor_t *src,
74627458
* used for error tracking only. It is not (yet) possible to allocate memory
74637459
* on the remote image. */
74647460
bool realloc_dst = false, extent_mismatch = false;
7465-
/* Set when the first non-scalar array reference is encountered. */
7466-
bool in_array_ref = false;
74677461
/* Set when remote data is to be accessed through the
74687462
* global dynamic window. */
74697463
bool access_data_through_global_win = false;
@@ -7716,7 +7710,6 @@ PREFIX(send_by_ref)(caf_token_t token, int image_index, gfc_descriptor_t *src,
77167710
/* Do further checks, when the source is not scalar. */
77177711
else if (delta != 1)
77187712
{
7719-
in_array_ref = true;
77207713
/* When the realloc is required, then no extent may have
77217714
* been set. */
77227715
extent_mismatch = GFC_DESCRIPTOR_EXTENT(dst, src_cur_dim) < delta;
@@ -7750,7 +7743,6 @@ PREFIX(send_by_ref)(caf_token_t token, int image_index, gfc_descriptor_t *src,
77507743
}
77517744
size *= (ptrdiff_t)delta;
77527745
}
7753-
in_array_ref = false;
77547746
break;
77557747
case CAF_REF_STATIC_ARRAY:
77567748
for (i = 0; riter->u.a.mode[i] != CAF_ARR_REF_NONE; ++i)
@@ -7829,7 +7821,6 @@ PREFIX(send_by_ref)(caf_token_t token, int image_index, gfc_descriptor_t *src,
78297821
/* Do further checks, when the source is not scalar. */
78307822
else if (delta != 1)
78317823
{
7832-
in_array_ref = true;
78337824
/* When the realloc is required, then no extent may have
78347825
* been set. */
78357826
extent_mismatch = GFC_DESCRIPTOR_EXTENT(dst, src_cur_dim) < delta;
@@ -7847,7 +7838,6 @@ PREFIX(send_by_ref)(caf_token_t token, int image_index, gfc_descriptor_t *src,
78477838
}
78487839
size *= (ptrdiff_t)delta;
78497840
}
7850-
in_array_ref = false;
78517841
break;
78527842
default:
78537843
caf_internal_error(unknownreftype, stat, NULL, 0);
@@ -7965,7 +7955,6 @@ PREFIX(sendget_by_ref)(caf_token_t dst_token, int dst_image_index,
79657955
int global_dst_rank, global_src_rank, memptr_dst_rank, memptr_src_rank;
79667956
/* Set when the first non-scalar array reference is encountered. */
79677957
bool in_array_ref = false;
7968-
bool array_extent_fixed = false;
79697958
/* Set when remote data is to be accessed through the
79707959
* global dynamic window. */
79717960
bool access_data_through_global_win = false;
@@ -8193,10 +8182,7 @@ PREFIX(sendget_by_ref)(caf_token_t dst_token, int dst_image_index,
81938182
size *= (ptrdiff_t)delta;
81948183
}
81958184
if (in_array_ref)
8196-
{
8197-
array_extent_fixed = true;
81988185
in_array_ref = false;
8199-
}
82008186
break;
82018187
case CAF_REF_STATIC_ARRAY:
82028188
for (i = 0; riter->u.a.mode[i] != CAF_ARR_REF_NONE; ++i)
@@ -8258,10 +8244,7 @@ PREFIX(sendget_by_ref)(caf_token_t dst_token, int dst_image_index,
82588244
size *= (ptrdiff_t)delta;
82598245
}
82608246
if (in_array_ref)
8261-
{
8262-
array_extent_fixed = true;
82638247
in_array_ref = false;
8264-
}
82658248
break;
82668249
default:
82678250
caf_runtime_error(unknownreftype, src_stat, NULL, 0);
@@ -8368,7 +8351,7 @@ PREFIX(is_present)(caf_token_t token, int image_index, caf_reference_t *refs)
83688351
ptrdiff_t local_offset = 0;
83698352
void *remote_memptr = NULL, *remote_base_memptr = NULL;
83708353
bool carryOn = true, firstDesc = true;
8371-
caf_reference_t *riter = refs, *prev;
8354+
caf_reference_t *riter = refs;
83728355
size_t i, ref_rank;
83738356
int ierr;
83748357
gfc_max_dim_descriptor_t src_desc;
@@ -8457,7 +8440,6 @@ PREFIX(is_present)(caf_token_t token, int image_index, caf_reference_t *refs)
84578440
caf_runtime_error(unsupportedRefType);
84588441
return false;
84598442
} // switch
8460-
prev = riter;
84618443
riter = riter->next;
84628444
}
84638445

@@ -8548,7 +8530,7 @@ PREFIX(is_present)(caf_token_t token, int image_index, caf_reference_t *refs)
85488530
#ifdef EXTRA_DEBUG_OUTPUT
85498531
{
85508532
gfc_descriptor_t *src = (gfc_descriptor_t *)(&src_desc);
8551-
dprint("remote desc rank: %zd (ref_rank: %zd)\n",
8533+
dprint("remote desc rank: %d (ref_rank: %zd)\n",
85528534
GFC_DESCRIPTOR_RANK(src), ref_rank);
85538535
for (i = 0; i < GFC_DESCRIPTOR_RANK(src); ++i)
85548536
{
@@ -8638,7 +8620,9 @@ static void
86388620
sync_images_internal(int count, int images[], int *stat, char *errmsg,
86398621
size_t errmsg_len, bool internal)
86408622
{
8641-
int ierr = 0, i = 0, j = 0, int_zero = 0, done_count = 0, flag;
8623+
/* Marked as unused, because of conditional compilation. */
8624+
int ierr = 0, i = 0, j = 0, int_zero = 0, done_count = 0,
8625+
flag __attribute__((unused));
86428626
MPI_Status s;
86438627

86448628
#ifdef WITH_FAILED_IMAGES
@@ -9505,7 +9489,7 @@ void
95059489
PREFIX(event_post)(caf_token_t token, size_t index, int image_index, int *stat,
95069490
char *errmsg, charlen_t errmsg_len)
95079491
{
9508-
int value = 1, ierr = 0, flag;
9492+
int value = 1, ierr = 0;
95099493
MPI_Win *p = TOKEN(token);
95109494
const char msg[] = "Error on event post";
95119495
int image = (image_index == 0) ? mpi_this_image : image_index - 1;
@@ -9928,24 +9912,6 @@ unsupported_fail_images_message(const char *functionname)
99289912
#endif
99299913
}
99309914

9931-
/* Give a descriptive message when support for an allocatable components
9932-
* feature is not available. */
9933-
void
9934-
unimplemented_alloc_comps_message(const char *functionname)
9935-
{
9936-
fprintf(stderr,
9937-
"*** Message from libcaf_mpi runtime function '%s' on image %d:\n"
9938-
"*** Assigning to an allocatable coarray component of a derived type"
9939-
"is not yet supported with GCC 7.\n"
9940-
"*** Either revert to GCC 6 or convert all "
9941-
"puts (type(foo)::x; x%%y[recipient] = z) to "
9942-
"gets (z = x%%y[provider]).\n",
9943-
functionname, caf_this_image);
9944-
#ifdef STOP_ON_UNSUPPORTED
9945-
exit(EXIT_FAILURE);
9946-
#endif
9947-
}
9948-
99499915
void
99509916
PREFIX(form_team)(int team_id, caf_team_t *team,
99519917
int index __attribute__((unused)))

0 commit comments

Comments
 (0)