Update .clang-format
Per sdbusplus's clang-format file.
Change-Id: Ib7868577dda1bc7ccb300a305e9a3c65efab136c
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/.clang-format b/.clang-format
index 309a9d6..ea71ad6 100644
--- a/.clang-format
+++ b/.clang-format
@@ -17,7 +17,7 @@
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: false
+AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
@@ -42,15 +42,29 @@
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
-DerivePointerAlignment: true
+DerivePointerAlignment: false
PointerAlignment: Left
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
+IncludeBlocks: Regroup
+IncludeCategories:
+ - Regex: '^[<"](gtest|gmock)'
+ Priority: 5
+ - Regex: '^"config.h"'
+ Priority: -1
+ - Regex: '^".*\.hpp"'
+ Priority: 1
+ - Regex: '^<.*\.h>'
+ Priority: 2
+ - Regex: '^<.*'
+ Priority: 3
+ - Regex: '.*'
+ Priority: 4
IndentCaseLabels: true
IndentWidth: 4
-IndentWrappedFunctionNames: false
+IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
@@ -65,9 +79,9 @@
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PointerAlignment: Right
ReflowComments: true
-SortIncludes: false
+SortIncludes: true
+SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
diff --git a/example.cpp b/example.cpp
index 6754b0e..e644f2b 100644
--- a/example.cpp
+++ b/example.cpp
@@ -14,13 +14,13 @@
* limitations under the License.
*/
+#include "lpcsnoop/snoop_listen.hpp"
+
#include <cinttypes>
#include <cstdio>
#include <iostream>
#include <memory>
-#include "lpcsnoop/snoop_listen.hpp"
-
/* Example PostCode handler which simply prints them */
static void printPostcode(uint64_t postcode)
{
diff --git a/lpcsnoop/snoop.hpp b/lpcsnoop/snoop.hpp
index 90729be..acaeca7 100644
--- a/lpcsnoop/snoop.hpp
+++ b/lpcsnoop/snoop.hpp
@@ -2,8 +2,7 @@
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server.hpp>
-
-#include "xyz/openbmc_project/State/Boot/Raw/server.hpp"
+#include <xyz/openbmc_project/State/Boot/Raw/server.hpp>
/* The LPC snoop on port 80h is mapped to this dbus path. */
#define SNOOP_OBJECTPATH "/xyz/openbmc_project/state/boot/raw"
diff --git a/lpcsnoop/snoop_listen.hpp b/lpcsnoop/snoop_listen.hpp
index 4d0ef36..5d7239e 100644
--- a/lpcsnoop/snoop_listen.hpp
+++ b/lpcsnoop/snoop_listen.hpp
@@ -14,12 +14,12 @@
* limitations under the License.
*/
+#include "lpcsnoop/snoop.hpp"
+
#include <sdbusplus/bus.hpp>
#include <sdbusplus/message.hpp>
#include <sdbusplus/server.hpp>
-#include "lpcsnoop/snoop.hpp"
-
namespace lpcsnoop
{
using sdbusplus::message::variant_ns::get;
diff --git a/main.cpp b/main.cpp
index 2ec34d0..52f0bc4 100644
--- a/main.cpp
+++ b/main.cpp
@@ -14,20 +14,20 @@
* limitations under the License.
*/
+#include "lpcsnoop/snoop.hpp"
+
#include <fcntl.h>
#include <getopt.h>
+#include <sys/epoll.h>
+#include <systemd/sd-event.h>
#include <unistd.h>
#include <array>
#include <cstdint>
#include <iostream>
#include <memory>
-#include <sys/epoll.h>
-#include <systemd/sd-event.h>
#include <thread>
-#include "lpcsnoop/snoop.hpp"
-
static const char* snoopFilename = "/dev/aspeed-lpc-snoop0";
static size_t codeSize = 1; /* Size of each POST code in bytes */
diff --git a/test/post_reporter_test.cpp b/test/post_reporter_test.cpp
index d1a158e..0dbbcfe 100644
--- a/test/post_reporter_test.cpp
+++ b/test/post_reporter_test.cpp
@@ -1,15 +1,16 @@
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "lpcsnoop/snoop.hpp"
+
#include <sdbusplus/bus.hpp>
#include <sdbusplus/test/sdbus_mock.hpp>
-#include "lpcsnoop/snoop.hpp"
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+using ::testing::_;
using ::testing::IsNull;
using ::testing::NiceMock;
using ::testing::Return;
using ::testing::StrEq;
-using ::testing::_;
namespace
{