Skip to content

Commit 4eef481

Browse files
authored
Clang format newline (#29)
* using same clang format binary than faasm * applied new clang-format to all codebase * adding newline at the end of the bash script
1 parent 521fe47 commit 4eef481

Some content is hidden

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

73 files changed

+89
-73
lines changed

Diff for: bin/run_clang_format.sh

+17-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
set -e
44

5+
function append_newline {
6+
if [[ -z "$(tail -c 1 "$1")" ]]; then
7+
:
8+
else
9+
echo >> "$1"
10+
fi
11+
}
12+
513
if [ -z "$1" ]; then
614
TARGET_DIR="."
715
else
@@ -11,7 +19,15 @@ fi
1119
pushd ${TARGET_DIR} >> /dev/null
1220

1321
# Find all source files using Git to automatically respect .gitignore
14-
clang-format-10 -i $(git ls-files "*.h" "*.cpp" "*.c")
22+
FILES=$(git ls-files "*.h" "*.cpp" "*.c")
23+
24+
# Run clang-format
25+
clang-format-10 -i ${FILES}
26+
27+
# Check newlines
28+
for f in ${FILES}; do
29+
append_newline $f
30+
done
1531

1632
popd >> /dev/null
1733

Diff for: faabric.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
// Stub to link together top-level CMake library
1+
// Stub to link together top-level CMake library

Diff for: include/faabric/executor/FaabricExecutor.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ class FaabricExecutor
5959
bool success,
6060
const std::string& errorMsg);
6161
};
62-
}
62+
}

Diff for: include/faabric/executor/FaabricMain.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ class FaabricMain
2121

2222
faabric::executor::FaabricPool& pool;
2323
};
24-
}
24+
}

Diff for: include/faabric/proto/RPCServer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ class RPCServer
2828

2929
virtual void doStart(const std::string& serverAddr) = 0;
3030
};
31-
}
31+
}

Diff for: include/faabric/proto/macros.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
#define DEFAULT_RPC_HOST "0.0.0.0"
1313
#define STATE_PORT 8003
1414
#define FUNCTION_CALL_PORT 8004
15-
#define MPI_MESSAGE_PORT 8005
15+
#define MPI_MESSAGE_PORT 8005

Diff for: include/faabric/scheduler/ExecGraph.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ int countExecGraphNodes(const ExecGraph& graph);
2020
std::string execNodeToJson(const ExecGraphNode& node);
2121

2222
std::string execGraphToJson(const ExecGraph& graph);
23-
}
23+
}

Diff for: include/faabric/scheduler/FunctionCallClient.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ class FunctionCallClient
2828

2929
void sendMPIMessage(const faabric::MPIMessage& msg);
3030
};
31-
}
31+
}

Diff for: include/faabric/scheduler/FunctionCallServer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ class FunctionCallServer final
3030
private:
3131
Scheduler& scheduler;
3232
};
33-
}
33+
}

Diff for: include/faabric/scheduler/InMemoryMessageQueue.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
namespace faabric::scheduler {
77
typedef faabric::util::Queue<faabric::Message> InMemoryMessageQueue;
88
typedef std::pair<std::string, InMemoryMessageQueue*> InMemoryMessageQueuePair;
9-
}
9+
}

Diff for: include/faabric/scheduler/MpiContext.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ class MpiContext
2424
int rank;
2525
int worldId;
2626
};
27-
}
27+
}

Diff for: include/faabric/scheduler/Scheduler.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,4 @@ class Scheduler
132132
};
133133

134134
Scheduler& getScheduler();
135-
}
135+
}

Diff for: include/faabric/state/DummyStateServer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ class DummyStateServer
2929
state::StateServer stateServer;
3030
};
3131

32-
}
32+
}

Diff for: include/faabric/state/InMemoryStateRegistry.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ class InMemoryStateRegistry
2727
};
2828

2929
InMemoryStateRegistry& getInMemoryStateRegistry();
30-
}
30+
}

Diff for: include/faabric/state/State.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ class State
4343
};
4444

4545
State& getGlobalState();
46-
}
46+
}

Diff for: include/faabric/state/StateClient.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ class StateClient
5454

5555
void unlock();
5656
};
57-
}
57+
}

Diff for: include/faabric/state/StateKeyValue.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,4 @@ class StateKeyValueException : public std::runtime_error
177177
: runtime_error(message)
178178
{}
179179
};
180-
}
180+
}

Diff for: include/faabric/state/StateServer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ class StateServer final
5959
private:
6060
State& state;
6161
};
62-
}
62+
}

Diff for: include/faabric/util/barrier.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ class Barrier
2323
std::mutex mx;
2424
std::condition_variable cv;
2525
};
26-
}
26+
}

Diff for: include/faabric/util/bytes.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ int safeCopyToBuffer(const uint8_t* dataIn,
1818
int dataLen,
1919
uint8_t* buffer,
2020
int bufferLen);
21-
}
21+
}

Diff for: include/faabric/util/chaining.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ class ChainedCallFailedException : public faabric::util::FaabricException
1515
: FaabricException(std::move(message))
1616
{}
1717
};
18-
}
18+
}

Diff for: include/faabric/util/clock.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ class Clock
2222
};
2323

2424
Clock& getGlobalClock();
25-
}
25+
}

Diff for: include/faabric/util/config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ class SystemConfig
7676
};
7777

7878
SystemConfig& getSystemConfig();
79-
}
79+
}

Diff for: include/faabric/util/environment.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ std::string setEnvVar(const std::string& varName, const std::string& value);
1010
void unsetEnvVar(const std::string& varName);
1111

1212
unsigned int getUsableCores();
13-
}
13+
}

Diff for: include/faabric/util/exception.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ class FaabricException : public std::exception
1919
protected:
2020
std::string _message;
2121
};
22-
}
22+
}

Diff for: include/faabric/util/files.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ class FileAtUrlIsDirectoryException : public faabric::util::FaabricException
3737
: FaabricException(std::move(message))
3838
{}
3939
};
40-
}
40+
}

Diff for: include/faabric/util/gids.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
namespace faabric::util {
66
unsigned int generateGid();
7-
}
7+
}

Diff for: include/faabric/util/json.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ class JsonFieldNotFound : public faabric::util::FaabricException
1818

1919
std::string getValueFromJsonString(const std::string& key,
2020
const std::string& jsonIn);
21-
}
21+
}

Diff for: include/faabric/util/locks.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ namespace faabric::util {
77
typedef std::unique_lock<std::mutex> UniqueLock;
88
typedef std::unique_lock<std::shared_mutex> FullLock;
99
typedef std::shared_lock<std::shared_mutex> SharedLock;
10-
}
10+
}

Diff for: include/faabric/util/logging.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ namespace faabric::util {
66
void initLogging();
77

88
std::shared_ptr<spdlog::logger> getLogger();
9-
}
9+
}

Diff for: include/faabric/util/memory.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ size_t getRequiredHostPagesRoundDown(size_t nBytes);
2525
size_t alignOffsetDown(size_t offset);
2626

2727
AlignedChunk getPageAlignedChunk(long offset, long length);
28-
}
28+
}

Diff for: include/faabric/util/network.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ namespace faabric::util {
88
std::string getIPFromHostname(const std::string& hostname);
99

1010
std::string getPrimaryIPForThisHost(const std::string& interface);
11-
}
11+
}

Diff for: include/faabric/util/queue.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@ class TokenPool
9898
int _size;
9999
Queue<int> queue;
100100
};
101-
}
101+
}

Diff for: include/faabric/util/random.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ namespace faabric::util {
66
std::string randomString(int len);
77

88
std::string randomStringFromSet(const std::unordered_set<std::string>& s);
9-
}
9+
}

Diff for: include/faabric/wasm/wasm.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#pragma once
22

3-
int helloFaabricWasm();
3+
int helloFaabricWasm();

Diff for: src/executor/FaabricExecutor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,4 @@ void FaabricExecutor::postFinish() {}
219219

220220
void FaabricExecutor::postFlush() {}
221221

222-
}
222+
}

Diff for: src/proto/RPCServer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ void RPCServer::stop()
5050
}
5151
}
5252
}
53-
}
53+
}

Diff for: src/scheduler/FunctionCallClient.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ void FunctionCallClient::sendMPIMessage(const faabric::MPIMessage& msg)
2626
faabric::FunctionStatusResponse response;
2727
CHECK_RPC("mpi_message", stub->MPICall(&context, msg, &response));
2828
}
29-
}
29+
}

Diff for: src/scheduler/FunctionCallServer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ Status FunctionCallServer::MPICall(ServerContext* context,
6666

6767
return Status::OK;
6868
}
69-
}
69+
}

Diff for: src/scheduler/MpiContext.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ int MpiContext::getWorldId()
6565
{
6666
return worldId;
6767
}
68-
}
68+
}

Diff for: src/scheduler/MpiWorldRegistry.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ void MpiWorldRegistry::clear()
6868
faabric::util::FullLock lock(registryMutex);
6969
worldMap.clear();
7070
}
71-
}
71+
}

Diff for: src/scheduler/Scheduler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -727,4 +727,4 @@ std::unordered_set<unsigned int> Scheduler::getChainedFunctions(
727727

728728
return chainedIds;
729729
}
730-
}
730+
}

Diff for: src/state/DummyStateServer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ void DummyStateServer::stop()
9494
serverThread.join();
9595
}
9696
}
97-
}
97+
}

Diff for: src/state/RedisStateKeyValue.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,4 @@ void RedisStateKeyValue::clearAppendedFromRemote()
143143
{
144144
redis::Redis::getState().del(joinedKey);
145145
}
146-
}
146+
}

Diff for: src/state/StateClient.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,4 @@ void StateClient::unlock()
201201
ClientContext context;
202202
CHECK_RPC("state_unlock", stub->Unlock(&context, request, &response))
203203
}
204-
}
204+
}

Diff for: src/state/StateKeyValue.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -630,4 +630,4 @@ std::vector<StateChunk> StateKeyValue::getDirtyChunks(
630630

631631
return chunks;
632632
}
633-
}
633+
}

Diff for: src/util/barrier.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ int Barrier::getUseCount()
3939
return uses;
4040
}
4141

42-
}
42+
}

Diff for: src/util/environment.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ unsigned int getUsableCores()
4444

4545
return nCores;
4646
}
47-
}
47+
}

Diff for: src/util/gids.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ unsigned int generateGid()
3232
return intHash + counter.fetch_add(1);
3333
}
3434
}
35-
}
35+
}

Diff for: src/util/logging.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ std::shared_ptr<spdlog::logger> getLogger()
3939

4040
return logger;
4141
}
42-
}
42+
}

Diff for: src/util/random.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ std::string randomStringFromSet(const std::unordered_set<std::string>& s)
4343

4444
return *it;
4545
}
46-
}
46+
}

Diff for: src/util/timing.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ void nanosToTimespec(uint64_t nanos, struct timespec* nativeTimespec)
5252
nativeTimespec->tv_sec = nanos / 1000000000;
5353
nativeTimespec->tv_nsec = nanos % 1000000000;
5454
}
55-
}
55+
}

Diff for: tests/test/endpoint/test_handler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,4 @@ TEST_CASE("Check getting function status from endpoint", "[endpoint]")
145145

146146
REQUIRE(actual == expectedOutput);
147147
}
148-
}
148+
}

Diff for: tests/test/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ int main(int argc, char* argv[])
1313
fflush(stdout);
1414

1515
return result;
16-
}
16+
}

0 commit comments

Comments
 (0)