Skip to content

Commit a625a81

Browse files
committed
Clang-format the code
Signed-off-by: Ralph Castain <[email protected]>
1 parent d9a0c9c commit a625a81

File tree

544 files changed

+27063
-29628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

544 files changed

+27063
-29628
lines changed

.clang-format

+15-17
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#
2424
# To run against all of PRRTE:
2525
#
26-
# ./contrib/clang-format-pmix.sh
26+
# ./contrib/clang-format-prte.sh
2727
#
2828
# This command is intended to be run only once.
2929
---
@@ -36,15 +36,15 @@ AlignConsecutiveAssignments: false
3636
AlignConsecutiveBitFields: false
3737
AlignConsecutiveDeclarations: false
3838
AlignEscapedNewlines: Left
39-
AlignOperands: Align
39+
AlignOperands: true
4040
AlignTrailingComments: true
41-
AllowAllArgumentsOnNextLine: true
41+
AllowAllArgumentsOnNextLine: false
4242
AllowAllConstructorInitializersOnNextLine: true
4343
AllowAllParametersOfDeclarationOnNextLine: true
4444
AllowShortEnumsOnASingleLine: true
4545
AllowShortBlocksOnASingleLine: Never
4646
AllowShortCaseLabelsOnASingleLine: false
47-
AllowShortFunctionsOnASingleLine: All
47+
AllowShortFunctionsOnASingleLine: None
4848
AllowShortLambdasOnASingleLine: All
4949
AllowShortIfStatementsOnASingleLine: Never
5050
AllowShortLoopsOnASingleLine: false
@@ -73,7 +73,7 @@ BraceWrapping:
7373
SplitEmptyFunction: true
7474
SplitEmptyRecord: true
7575
SplitEmptyNamespace: true
76-
BreakBeforeBinaryOperators: None
76+
BreakBeforeBinaryOperators: true
7777
BreakBeforeBraces: Custom
7878
BreakBeforeInheritanceComma: false
7979
BreakInheritanceList: BeforeColon
@@ -92,23 +92,22 @@ Cpp11BracedListStyle: true
9292
DeriveLineEnding: true
9393
DerivePointerAlignment: false
9494
DisableFormat: false
95-
ExperimentalAutoDetectBinPacking: false
9695
FixNamespaceComments: true
9796
ForEachMacros:
9897
- foreach
9998
- Q_FOREACH
10099
- BOOST_FOREACH
101100
- BOOST_FOREACH
102-
- OPAL_LIST_FOREACH
103-
- OPAL_LIST_FOREACH_DECL
104-
- OPAL_LIST_FOREACH_SAFE
105-
- OPAL_LIST_FOREACH_REV
106-
- OPAL_LIST_FOREACH_SAFE_REV
107-
- OPAL_HASH_TABLE_FOREACH
108-
- OPAL_HASH_TABLE_FOREACH_PTR
101+
- PMIX_LIST_FOREACH
102+
- PMIX_LIST_FOREACH_DECL
103+
- PMIX_LIST_FOREACH_SAFE
104+
- PMIX_LIST_FOREACH_REV
105+
- PMIX_LIST_FOREACH_SAFE_REV
106+
- PMIX_HASH_TABLE_FOREACH
107+
- PMIX_HASH_TABLE_FOREACH_PTR
109108
IncludeBlocks: Preserve
110109
IncludeCategories:
111-
# Ensure config includes always come first (opal_config.h, ompi_config.h, etc)
110+
# Ensure config includes always come first (prte_config.h, etc)
112111
- Regex: '^".*_config\.h"'
113112
Priority: -1
114113
# In-tree includes come next (after main include)
@@ -139,8 +138,8 @@ ObjCBlockIndentWidth: 4
139138
ObjCBreakBeforeNestedBlockParam: true
140139
ObjCSpaceAfterProperty: false
141140
ObjCSpaceBeforeProtocolList: true
142-
PenaltyBreakAssignment: 300
143-
PenaltyBreakBeforeFirstCallParameter: 300
141+
PenaltyBreakAssignment: 250
142+
PenaltyBreakBeforeFirstCallParameter: 301
144143
PenaltyBreakComment: 300
145144
PenaltyBreakFirstLessLess: 120
146145
PenaltyBreakString: 1000
@@ -186,4 +185,3 @@ WhitespaceSensitiveMacros:
186185
- BOOST_PP_STRINGIZE
187186
...
188187

189-

contrib/clang-format-prte.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
echo "Running clang-format on code base..."
44

5-
files=($(git ls-tree -r master --name-only | grep -v 'contrib' | grep -e '.*\.[ch]$'))
5+
files=($(git ls-tree -r master --name-only | grep -v -E 'contrib/' | grep -e '.*\.[ch]$' ))
66

77
for file in "${files[@]}" ; do
88
if test "$1" = "-d" ; then
@@ -13,4 +13,3 @@ for file in "${files[@]}" ; do
1313
done
1414

1515
echo "Done"
16-

examples/alloc.c

+40-42
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
1616
* Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
1717
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
18+
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
1819
* $COPYRIGHT$
1920
*
2021
* Additional copyrights may follow
@@ -26,11 +27,11 @@
2627
#include <stdbool.h>
2728
#include <stdio.h>
2829
#include <stdlib.h>
29-
#include <unistd.h>
3030
#include <time.h>
31+
#include <unistd.h>
3132

32-
#include <pmix.h>
3333
#include "examples.h"
34+
#include <pmix.h>
3435

3536
/* this is a callback function for the PMIx_Query and
3637
* PMIx_Allocate APIs. The query will callback with a status indicating
@@ -44,13 +45,10 @@
4445
* Once we have dealt with the returned data, we must
4546
* call the release_fn so that the PMIx library can
4647
* cleanup */
47-
static void infocbfunc(pmix_status_t status,
48-
pmix_info_t *info, size_t ninfo,
49-
void *cbdata,
50-
pmix_release_cbfunc_t release_fn,
51-
void *release_cbdata)
48+
static void infocbfunc(pmix_status_t status, pmix_info_t *info, size_t ninfo, void *cbdata,
49+
pmix_release_cbfunc_t release_fn, void *release_cbdata)
5250
{
53-
myquery_data_t *mq = (myquery_data_t*)cbdata;
51+
myquery_data_t *mq = (myquery_data_t *) cbdata;
5452
size_t n;
5553

5654
fprintf(stderr, "Allocation request returned %s\n", PMIx_Error_string(status));
@@ -61,7 +59,7 @@ static void infocbfunc(pmix_status_t status,
6159
if (0 < ninfo) {
6260
PMIX_INFO_CREATE(mq->info, ninfo);
6361
mq->ninfo = ninfo;
64-
for (n=0; n < ninfo; n++) {
62+
for (n = 0; n < ninfo; n++) {
6563
fprintf(stderr, "Transferring %s\n", info[n].key);
6664
PMIX_INFO_XFER(&mq->info[n], &info[n]);
6765
}
@@ -86,22 +84,19 @@ static void infocbfunc(pmix_status_t status,
8684
* the status to see if it was "alloc complete", but it often is simpler
8785
* to declare a use-specific notification callback point. In this case,
8886
* we are asking to know when the allocation request completes */
89-
static void release_fn(size_t evhdlr_registration_id,
90-
pmix_status_t status,
91-
const pmix_proc_t *source,
92-
pmix_info_t info[], size_t ninfo,
87+
static void release_fn(size_t evhdlr_registration_id, pmix_status_t status,
88+
const pmix_proc_t *source, pmix_info_t info[], size_t ninfo,
9389
pmix_info_t results[], size_t nresults,
94-
pmix_event_notification_cbfunc_fn_t cbfunc,
95-
void *cbdata)
90+
pmix_event_notification_cbfunc_fn_t cbfunc, void *cbdata)
9691
{
9792
myrel_t *lock;
9893
size_t n;
9994

10095
/* find the return object */
10196
lock = NULL;
102-
for (n=0; n < ninfo; n++) {
97+
for (n = 0; n < ninfo; n++) {
10398
if (0 == strncmp(info[n].key, PMIX_EVENT_RETURN_OBJECT, PMIX_MAX_KEYLEN)) {
104-
lock = (myrel_t*)info[n].value.data.ptr;
99+
lock = (myrel_t *) info[n].value.data.ptr;
105100
break;
106101
}
107102
}
@@ -134,15 +129,13 @@ static void release_fn(size_t evhdlr_registration_id,
134129
* to the registered event. The index is used later on to deregister
135130
* an event handler - if we don't explicitly deregister it, then the
136131
* PMIx server will do so when it sees us exit */
137-
static void evhandler_reg_callbk(pmix_status_t status,
138-
size_t evhandler_ref,
139-
void *cbdata)
132+
static void evhandler_reg_callbk(pmix_status_t status, size_t evhandler_ref, void *cbdata)
140133
{
141-
mylock_t *lock = (mylock_t*)cbdata;
134+
mylock_t *lock = (mylock_t *) cbdata;
142135

143136
if (PMIX_SUCCESS != status) {
144-
fprintf(stderr, "EVENT HANDLER REGISTRATION FAILED WITH STATUS %d, ref=%lu\n",
145-
status, (unsigned long)evhandler_ref);
137+
fprintf(stderr, "EVENT HANDLER REGISTRATION FAILED WITH STATUS %d, ref=%lu\n", status,
138+
(unsigned long) evhandler_ref);
146139
}
147140
lock->status = status;
148141
lock->evhandler_ref = evhandler_ref;
@@ -168,17 +161,19 @@ int main(int argc, char **argv)
168161

169162
/* init us */
170163
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) {
171-
fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank, rc);
164+
fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank,
165+
rc);
172166
exit(0);
173167
}
174168
fprintf(stderr, "Client ns %s rank %d: Running\n", myproc.nspace, myproc.rank);
175169

176170
/* get our job size */
177171
PMIX_PROC_CONSTRUCT(&proc);
178-
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
172+
(void) strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
179173
proc.rank = PMIX_RANK_WILDCARD;
180174
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) {
181-
fprintf(stderr, "Client ns %s rank %d: PMIx_Get job size failed: %d\n", myproc.nspace, myproc.rank, rc);
175+
fprintf(stderr, "Client ns %s rank %d: PMIx_Get job size failed: %d\n", myproc.nspace,
176+
myproc.rank, rc);
182177
goto done;
183178
}
184179
nprocs = val->data.uint32;
@@ -191,19 +186,20 @@ int main(int argc, char **argv)
191186
PMIX_INFO_CREATE(info, 2);
192187
PMIX_INFO_LOAD(&info[0], PMIX_ALLOC_NUM_NODES, &nnodes, PMIX_UINT64);
193188
PMIX_INFO_LOAD(&info[0], PMIX_ALLOC_ID, myallocation, PMIX_STRING);
194-
if (PMIX_SUCCESS != (rc = PMIx_Allocation_request_nb(PMIX_ALLOC_NEW, info, 2, infocbfunc, &mydata))) {
195-
fprintf(stderr, "Client ns %s rank %d: PMIx_Allocation_request_nb failed: %d\n", myproc.nspace, myproc.rank, rc);
189+
if (PMIX_SUCCESS
190+
!= (rc = PMIx_Allocation_request_nb(PMIX_ALLOC_NEW, info, 2, infocbfunc, &mydata))) {
191+
fprintf(stderr, "Client ns %s rank %d: PMIx_Allocation_request_nb failed: %d\n",
192+
myproc.nspace, myproc.rank, rc);
196193
goto done;
197194
}
198195
DEBUG_WAIT_THREAD(&mydata.lock);
199196
PMIX_INFO_FREE(info, 2);
200-
fprintf(stderr, "Client ns %s rank %d: Allocation returned status: %s\n",
201-
myproc.nspace, myproc.rank, PMIx_Error_string(mydata.lock.status));
197+
fprintf(stderr, "Client ns %s rank %d: Allocation returned status: %s\n", myproc.nspace,
198+
myproc.rank, PMIx_Error_string(mydata.lock.status));
202199
DEBUG_DESTRUCT_MYQUERY(&mydata);
203200
/* if it didn't succeed and we have peers out there, then we better wake
204201
* them up */
205202

206-
207203
} else if (1 == myproc.rank) {
208204
/* demonstrate a notification based approach - register a handler
209205
* specifically for when the allocation operation completes */
@@ -213,17 +209,17 @@ int main(int argc, char **argv)
213209
PMIX_INFO_LOAD(&info[1], PMIX_EVENT_RETURN_OBJECT, &myrel, PMIX_POINTER);
214210
DEBUG_CONSTRUCT_LOCK(&mylock);
215211
code = PMIX_NOTIFY_ALLOC_COMPLETE;
216-
PMIx_Register_event_handler(&code, 1, info, 2,
217-
release_fn, evhandler_reg_callbk, (void*)&mylock);
212+
PMIx_Register_event_handler(&code, 1, info, 2, release_fn, evhandler_reg_callbk,
213+
(void *) &mylock);
218214
DEBUG_WAIT_THREAD(&mylock);
219215
PMIX_INFO_FREE(info, 2);
220216
rc = mylock.status;
221217
DEBUG_DESTRUCT_LOCK(&mylock);
222218

223219
/* now wait to hear that the request is complete */
224220
DEBUG_WAIT_THREAD(&myrel.lock);
225-
fprintf(stderr, "[%s:%d] Allocation returned status: %s\n",
226-
myproc.nspace, myproc.rank, PMIx_Error_string(myrel.lock.status));
221+
fprintf(stderr, "[%s:%d] Allocation returned status: %s\n", myproc.nspace, myproc.rank,
222+
PMIx_Error_string(myrel.lock.status));
227223
DEBUG_DESTRUCT_MYREL(&myrel);
228224

229225
} else {
@@ -237,25 +233,27 @@ int main(int argc, char **argv)
237233
PMIX_INFO_CREATE(query[0].qualifiers, 1);
238234
PMIX_INFO_LOAD(&query[0].qualifiers[0], PMIX_ALLOC_ID, myallocation, PMIX_STRING);
239235

240-
if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, 1, infocbfunc, (void*)&mydata))) {
236+
if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, 1, infocbfunc, (void *) &mydata))) {
241237
fprintf(stderr, "PMIx_Query_info failed: %d\n", rc);
242238
goto done;
243239
}
244240
DEBUG_WAIT_THREAD(&mydata.lock);
245241
PMIX_QUERY_FREE(query, 1);
246-
fprintf(stderr, "[%s:%d] Allocation returned status: %s\n",
247-
myproc.nspace, myproc.rank, PMIx_Error_string(mydata.lock.status));
242+
fprintf(stderr, "[%s:%d] Allocation returned status: %s\n", myproc.nspace, myproc.rank,
243+
PMIx_Error_string(mydata.lock.status));
248244
DEBUG_DESTRUCT_MYQUERY(&mydata);
249245
}
250246

251-
done:
247+
done:
252248
/* finalize us */
253249
fprintf(stderr, "Client ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank);
254250
if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) {
255-
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc);
251+
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace,
252+
myproc.rank, rc);
256253
} else {
257-
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n", myproc.nspace, myproc.rank);
254+
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n",
255+
myproc.nspace, myproc.rank);
258256
}
259257
fflush(stderr);
260-
return(0);
258+
return (0);
261259
}

0 commit comments

Comments
 (0)