From: AdrianF <adrian.freihofer@siemens.com>
To: openembedded-core@lists.openembedded.org
Cc: Adrian Freihofer <adrian.freihofer@siemens.com>
Subject: [PATCH 08/15] cpp-example: update formatting and code style
Date: Wed, 9 Sep 2026 23:53:08 +0200 [thread overview]
Message-ID: <20260909215337.89106-9-adrian.freihofer@siemens.com> (raw)
In-Reply-To: <20260909215337.89106-1-adrian.freihofer@siemens.com>
From: Adrian Freihofer <adrian.freihofer@siemens.com>
Just run clang-format on the source files and add the .clang-format
configuration file.
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
.../recipes-test/cpp/cpp-example.inc | 1 +
.../recipes-test/cpp/files/.clang-format | 42 +++++++++++++++++++
.../recipes-test/cpp/files/cpp-example.cpp | 4 +-
.../recipes-test/cpp/files/daemonize.cpp | 2 +-
.../recipes-test/cpp/files/daemonize.hpp | 2 +-
.../cpp/files/test-cpp-example.cpp | 13 +++---
6 files changed, 54 insertions(+), 10 deletions(-)
create mode 100644 meta-selftest/recipes-test/cpp/files/.clang-format
diff --git a/meta-selftest/recipes-test/cpp/cpp-example.inc b/meta-selftest/recipes-test/cpp/cpp-example.inc
index 3934345f17..603040d123 100644
--- a/meta-selftest/recipes-test/cpp/cpp-example.inc
+++ b/meta-selftest/recipes-test/cpp/cpp-example.inc
@@ -22,6 +22,7 @@ SRC_URI = "\
file://config.h.in \
file://cpp-example.service \
file://cpp-example.init \
+ file://.clang-format \
file://run-ptest \
"
diff --git a/meta-selftest/recipes-test/cpp/files/.clang-format b/meta-selftest/recipes-test/cpp/files/.clang-format
new file mode 100644
index 0000000000..e22fadaee9
--- /dev/null
+++ b/meta-selftest/recipes-test/cpp/files/.clang-format
@@ -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
diff --git a/meta-selftest/recipes-test/cpp/files/cpp-example.cpp b/meta-selftest/recipes-test/cpp/files/cpp-example.cpp
index f18911554c..af7a8c2d73 100644
--- a/meta-selftest/recipes-test/cpp/files/cpp-example.cpp
+++ b/meta-selftest/recipes-test/cpp/files/cpp-example.cpp
@@ -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
diff --git a/meta-selftest/recipes-test/cpp/files/daemonize.cpp b/meta-selftest/recipes-test/cpp/files/daemonize.cpp
index 7d91259bfa..e4752124f6 100644
--- a/meta-selftest/recipes-test/cpp/files/daemonize.cpp
+++ b/meta-selftest/recipes-test/cpp/files/daemonize.cpp
@@ -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;
diff --git a/meta-selftest/recipes-test/cpp/files/daemonize.hpp b/meta-selftest/recipes-test/cpp/files/daemonize.hpp
index 17d85d690a..d837836e02 100644
--- a/meta-selftest/recipes-test/cpp/files/daemonize.hpp
+++ b/meta-selftest/recipes-test/cpp/files/daemonize.hpp
@@ -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.
diff --git a/meta-selftest/recipes-test/cpp/files/test-cpp-example.cpp b/meta-selftest/recipes-test/cpp/files/test-cpp-example.cpp
index e1909c3168..d8f2547e88 100644
--- a/meta-selftest/recipes-test/cpp/files/test-cpp-example.cpp
+++ b/meta-selftest/recipes-test/cpp/files/test-cpp-example.cpp
@@ -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;
--
2.55.0
next prev parent reply other threads:[~2026-09-09 21:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 21:53 [PATCH 00/15] devtool ide-sdk: support booting from NFS, VSCode clangd AdrianF
2026-09-09 21:53 ` [PATCH 01/15] devtool: deploy: split ssh deployment into a separate function AdrianF
2026-09-09 21:53 ` [PATCH 02/15] devtool: deploy: allow deploying directly into a local rootfs directory AdrianF
2026-09-09 21:53 ` [PATCH 03/15] oe-selftest: devtool deploy-target: test deploying into a local rootfs path AdrianF
2026-09-09 21:53 ` [PATCH 04/15] devtool: ide-sdk: support NFS rootfs AdrianF
2026-09-09 21:53 ` [PATCH 05/15] oe-selftest: devtool ide-sdk: test NFS debug rootfs AdrianF
2026-09-09 21:53 ` [PATCH 06/15] runqemu-extract-sdk: refactor in Python AdrianF
2026-09-10 17:45 ` [OE-core] " Richard Purdie
2026-09-09 21:53 ` [PATCH 07/15] devtool: ide-sdk: reuse pseudo_rootfs_utils for SDK rootfs extraction AdrianF
2026-09-09 21:53 ` AdrianF [this message]
2026-09-09 21:53 ` [PATCH 09/15] cpp-example: fix clang-tidy warnings AdrianF
2026-09-09 21:53 ` [PATCH 10/15] devtool: ide-sdk: add clangd support for VSCode IntelliSense AdrianF
2026-09-09 21:53 ` [PATCH 11/15] devtool: ide-sdk: support clangd for non-clang toolchain recipes AdrianF
2026-09-09 21:53 ` [PATCH 12/15] devtool: ide-sdk: format C/C++ with clangd when .clang-format is present AdrianF
2026-09-09 21:53 ` [PATCH 13/15] devtool: ide-sdk: support LLDB ATTACH mode AdrianF
2026-09-09 21:53 ` [PATCH 14/15] devtool: ide-sdk: pin BBPATH in generated do_install script AdrianF
2026-09-09 21:53 ` [PATCH 15/15] buildstats: close proc/disk log files via weakref.finalize safety net AdrianF
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260909215337.89106-9-adrian.freihofer@siemens.com \
--to=adrian.freihofer@siemens.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox