@@ -22,6 +22,7 @@ SRC_URI = "\
file://config.h.in \
file://cpp-example.service \
file://cpp-example.init \
+ file://.clang-format \
file://run-ptest \
"
new file mode 100644
@@ -0,0 +1,42 @@
+---
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+BasedOnStyle: LLVM
+Language: Cpp
+Standard: c++17
+
+IndentWidth: 4
+UseTab: Never
+ColumnLimit: 100
+
+BreakBeforeBraces: Custom
+BraceWrapping:
+ AfterFunction: true
+ AfterClass: true
+ AfterStruct: true
+ AfterEnum: true
+ AfterUnion: true
+ AfterNamespace: false
+ AfterControlStatement: Never
+ BeforeElse: false
+ BeforeCatch: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+AlwaysBreakAfterReturnType: None
+IndentCaseLabels: true
+NamespaceIndentation: None
+AccessModifierOffset: -4
+
+PointerAlignment: Right
+ReferenceAlignment: Right
+SpaceAfterCStyleCast: false
+SpaceBeforeParens: ControlStatements
+
+AllowShortFunctionsOnASingleLine: Empty
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLoopsOnASingleLine: false
+AllowShortBlocksOnASingleLine: Never
+
+SortIncludes: false
+IncludeBlocks: Preserve
@@ -28,7 +28,7 @@ bool g_use_syslog = false;
// Prints an informational message. Under systemd, stdout is already captured
// by the journal. Otherwise, use stdout until daemonized (stdio is then
// redirected to /dev/null), and syslog afterwards so messages aren't lost.
-void log_info(const std::string& msg)
+void log_info(const std::string &msg)
{
#ifndef WITH_SYSTEMD
if (g_use_syslog) {
@@ -41,7 +41,7 @@ void log_info(const std::string& msg)
} // namespace
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
{
bool endless_mode = false;
#ifndef WITH_SYSTEMD
@@ -38,7 +38,7 @@ void daemonize()
}
}
-void write_pidfile(const std::string& path)
+void write_pidfile(const std::string &path)
{
std::ofstream pidfile(path, std::ios::trunc);
pidfile << getpid() << std::endl;
@@ -20,7 +20,7 @@
void daemonize();
// Writes the current process's pid to the given path.
-void write_pidfile(const std::string& path);
+void write_pidfile(const std::string &path);
// Permanently drops from root to the given group/user. Must run gid before
// uid: once uid is dropped, the process no longer has permission to setgid.
@@ -1,8 +1,8 @@
/*
-* Copyright OpenEmbedded Contributors
-*
-* SPDX-License-Identifier: MIT
-*/
+ * Copyright OpenEmbedded Contributors
+ *
+ * SPDX-License-Identifier: MIT
+ */
#include "cpp-example-lib.hpp"
@@ -13,10 +13,11 @@
#define FAIL_COMPARISON_STR ""
#endif
-int main() {
+int main()
+{
auto cpp_example = CppExample();
auto ret_string = cpp_example.get_string();
- if(0 == ret_string.compare(CppExample::test_string + FAIL_COMPARISON_STR)) {
+ if (0 == ret_string.compare(CppExample::test_string + FAIL_COMPARISON_STR)) {
std::cout << "PASS: " << ret_string << " = " << CppExample::test_string << std::endl;
} else {
std::cout << "FAIL: " << ret_string << " != " << CppExample::test_string << std::endl;