From dd889c4fbc90fe37c9c665c7877dbb206efd8043 Mon Sep 17 00:00:00 2001 From: Mauro Baluda Date: Thu, 3 Nov 2022 17:24:37 +0100 Subject: [PATCH] Reformat test files with clang-format v14 --- cpp/autosar/test/rules/A5-1-9/test.cpp | 8 +-- cpp/autosar/test/rules/A5-2-2/test.cpp | 4 +- ...lyingBaseTypeNotExplicitlyDefined.expected | 2 +- cpp/autosar/test/rules/A7-2-2/test.cpp | 16 +++-- ...onsNotDeclaredAsScopedEnumClasses.expected | 2 +- cpp/autosar/test/rules/A7-2-3/test.cpp | 24 +++++-- ...rstOrAllEnumeratorsNotInitialized.expected | 8 +-- cpp/autosar/test/rules/A7-2-4/test.cpp | 68 +++++++++++++------ cpp/autosar/test/rules/A8-4-5/test.cpp | 2 +- cpp/autosar/test/rules/A8-4-6/test.cpp | 4 +- cpp/autosar/test/rules/M6-4-5/test.cpp | 2 +- cpp/autosar/test/rules/M8-4-4/test.cpp | 2 +- 12 files changed, 93 insertions(+), 49 deletions(-) diff --git a/cpp/autosar/test/rules/A5-1-9/test.cpp b/cpp/autosar/test/rules/A5-1-9/test.cpp index 5d1f455d51..466cf14dfa 100644 --- a/cpp/autosar/test/rules/A5-1-9/test.cpp +++ b/cpp/autosar/test/rules/A5-1-9/test.cpp @@ -86,16 +86,16 @@ void test_noncompliant() { #include class Test_issue468 { public: - template static void LogInfo(const As &... rest) { + template static void LogInfo(const As &...rest) { [](const std::string &s) -> void { LogInfo(s); }; // COMPLIANT } - template static void LogWarn(const As &... rest) { + template static void LogWarn(const As &...rest) { [](const std::string &s) -> void { LogWarn(s); }; // COMPLIANT } - template static void LogError(const As &... rest) { + template static void LogError(const As &...rest) { [](const std::string &s) -> void { LogError(s); }; // NON_COMPLIANT } - template static void LogFatal(const As &... rest) { + template static void LogFatal(const As &...rest) { [](const std::string &s) -> void { LogError(s); }; // NON_COMPLIANT } void instantiate() { diff --git a/cpp/autosar/test/rules/A5-2-2/test.cpp b/cpp/autosar/test/rules/A5-2-2/test.cpp index 23820114cb..7a0aef3eb3 100644 --- a/cpp/autosar/test/rules/A5-2-2/test.cpp +++ b/cpp/autosar/test/rules/A5-2-2/test.cpp @@ -45,12 +45,12 @@ void test_cpp_style_cast() { class A5_2_2a { public: template - static void Foo(const std::string &name, As &&... rest) { + static void Foo(const std::string &name, As &&...rest) { Fun(Log( std::forward(rest)...)); // COMPLIANT - reported as a false positive } - template static std::string Log(As &&... tail) { + template static std::string Log(As &&...tail) { return std::string(); } diff --git a/cpp/autosar/test/rules/A7-2-2/EnumerationUnderlyingBaseTypeNotExplicitlyDefined.expected b/cpp/autosar/test/rules/A7-2-2/EnumerationUnderlyingBaseTypeNotExplicitlyDefined.expected index d9c51d2b77..4d4c944f3f 100644 --- a/cpp/autosar/test/rules/A7-2-2/EnumerationUnderlyingBaseTypeNotExplicitlyDefined.expected +++ b/cpp/autosar/test/rules/A7-2-2/EnumerationUnderlyingBaseTypeNotExplicitlyDefined.expected @@ -1,2 +1,2 @@ | test.cpp:1:6:1:6 | C | Base type of enumeration is not explicitly specified. | -| test.cpp:3:12:3:12 | A | Base type of enumeration is not explicitly specified. | +| test.cpp:5:12:5:12 | A | Base type of enumeration is not explicitly specified. | diff --git a/cpp/autosar/test/rules/A7-2-2/test.cpp b/cpp/autosar/test/rules/A7-2-2/test.cpp index e55ab81c6d..5d0170bb93 100644 --- a/cpp/autosar/test/rules/A7-2-2/test.cpp +++ b/cpp/autosar/test/rules/A7-2-2/test.cpp @@ -1,8 +1,16 @@ enum C // NON_COMPLIANT -{ c1 }; +{ + c1 +}; enum class A // NON_COMPLIANT -{ a1 }; +{ + a1 +}; enum class B : int // COMPLIANT -{ b1 }; +{ + b1 +}; enum D : int // COMPLIANT -{ d1 }; +{ + d1 +}; diff --git a/cpp/autosar/test/rules/A7-2-3/EnumerationsNotDeclaredAsScopedEnumClasses.expected b/cpp/autosar/test/rules/A7-2-3/EnumerationsNotDeclaredAsScopedEnumClasses.expected index 3d3d208004..1e7b97e1f0 100644 --- a/cpp/autosar/test/rules/A7-2-3/EnumerationsNotDeclaredAsScopedEnumClasses.expected +++ b/cpp/autosar/test/rules/A7-2-3/EnumerationsNotDeclaredAsScopedEnumClasses.expected @@ -1,2 +1,2 @@ | test.cpp:1:6:1:6 | C | Enum C is not a scoped enum. | -| test.cpp:11:6:11:6 | D | Enum D is not a scoped enum. | +| test.cpp:21:6:21:6 | D | Enum D is not a scoped enum. | diff --git a/cpp/autosar/test/rules/A7-2-3/test.cpp b/cpp/autosar/test/rules/A7-2-3/test.cpp index 3a9dd414a3..76e3a9d78d 100644 --- a/cpp/autosar/test/rules/A7-2-3/test.cpp +++ b/cpp/autosar/test/rules/A7-2-3/test.cpp @@ -1,12 +1,24 @@ enum C // NON_COMPLIANT -{ c1 }; +{ + c1 +}; enum class A // COMPLIANT - Violates a different rule (A7-2-2) -{ a1 }; +{ + a1 +}; enum struct A1 // COMPLIANT - Violates a different rule (A7-2-2) -{ a12 }; +{ + a12 +}; enum class B : int // COMPLIANT -{ b1 }; +{ + b1 +}; enum struct B1 : int // COMPLIANT -{ b12 }; +{ + b12 +}; enum D : int // NON_COMPLIANT -{ d1 }; \ No newline at end of file +{ + d1 +}; \ No newline at end of file diff --git a/cpp/autosar/test/rules/A7-2-4/NoneFirstOrAllEnumeratorsNotInitialized.expected b/cpp/autosar/test/rules/A7-2-4/NoneFirstOrAllEnumeratorsNotInitialized.expected index dd75f69bff..f4ce14aac2 100644 --- a/cpp/autosar/test/rules/A7-2-4/NoneFirstOrAllEnumeratorsNotInitialized.expected +++ b/cpp/autosar/test/rules/A7-2-4/NoneFirstOrAllEnumeratorsNotInitialized.expected @@ -1,4 +1,4 @@ -| test.cpp:9:12:9:13 | A2 | Neither none, the first, or all enumerated constants are initialized in this enumeration. | -| test.cpp:33:14:33:15 | B3 | Neither none, the first, or all enumerated constants are initialized in this enumeration. | -| test.cpp:45:6:45:6 | D | Neither none, the first, or all enumerated constants are initialized in this enumeration. | -| test.cpp:53:6:53:7 | E1 | Neither none, the first, or all enumerated constants are initialized in this enumeration. | +| test.cpp:13:12:13:13 | A2 | Neither none, the first, or all enumerated constants are initialized in this enumeration. | +| test.cpp:47:14:47:15 | B3 | Neither none, the first, or all enumerated constants are initialized in this enumeration. | +| test.cpp:63:6:63:6 | D | Neither none, the first, or all enumerated constants are initialized in this enumeration. | +| test.cpp:75:6:75:7 | E1 | Neither none, the first, or all enumerated constants are initialized in this enumeration. | diff --git a/cpp/autosar/test/rules/A7-2-4/test.cpp b/cpp/autosar/test/rules/A7-2-4/test.cpp index 943a7944cb..51f7df642c 100644 --- a/cpp/autosar/test/rules/A7-2-4/test.cpp +++ b/cpp/autosar/test/rules/A7-2-4/test.cpp @@ -1,55 +1,79 @@ enum class A // COMPLIANT -{ a1 }; +{ + a1 +}; enum class A1 // COMPLIANT -{ a1 = 0, +{ + a1 = 0, a2 = 1, - a3 = 2 }; + a3 = 2 +}; enum class A2 // NON_COMPLIANT -{ a1, +{ + a1, a2 = 0, - a3 }; + a3 +}; enum class A3 // COMPLIANT -{ a1 = 0, +{ + a1 = 0, a2, - a3 }; + a3 +}; enum class B : int // COMPLIANT -{ b1 }; +{ + b1 +}; enum class B1 : int // COMPLIANT -{ b1, +{ + b1, b2, - b3 }; + b3 +}; enum class B2 : int // COMPLIANT -{ b1 = 0, +{ + b1 = 0, b2, - b3 }; + b3 +}; int f() { enum class B3 : int // NON_COMPLIANT - { b1, + { + b1, b2 = 0, - b3 = 0 }; + b3 = 0 + }; return 0; } enum C // COMPLIANT -{ c1, - c2 }; +{ + c1, + c2 +}; enum D // NON_COMPLIANT -{ d1, - d2 = 0 }; +{ + d1, + d2 = 0 +}; enum E : int // COMPLIANT -{ e1, - e2 }; +{ + e1, + e2 +}; enum E1 : int // NON_COMPLIANT -{ e11, - e22 = 0 }; \ No newline at end of file +{ + e11, + e22 = 0 +}; \ No newline at end of file diff --git a/cpp/autosar/test/rules/A8-4-5/test.cpp b/cpp/autosar/test/rules/A8-4-5/test.cpp index 0bb81d7851..65468aab22 100644 --- a/cpp/autosar/test/rules/A8-4-5/test.cpp +++ b/cpp/autosar/test/rules/A8-4-5/test.cpp @@ -48,7 +48,7 @@ class TestClass4 { // template type template -T test_forward(X &&... f) { // forward parameter +T test_forward(X &&...f) { // forward parameter return T{std::forward(f)...}; // COMPLIANT } diff --git a/cpp/autosar/test/rules/A8-4-6/test.cpp b/cpp/autosar/test/rules/A8-4-6/test.cpp index 489ac5d498..bc01e083b0 100644 --- a/cpp/autosar/test/rules/A8-4-6/test.cpp +++ b/cpp/autosar/test/rules/A8-4-6/test.cpp @@ -10,8 +10,8 @@ class TestClass2 { explicit TestClass2(const std::vector &v); }; // template type -template T make(X &&... x) { // forward param - return T{std::forward(x)...}; // COMPLIANT +template T make(X &&...x) { // forward param + return T{std::forward(x)...}; // COMPLIANT } // template type template T make2(U &&x) { // forward param diff --git a/cpp/autosar/test/rules/M6-4-5/test.cpp b/cpp/autosar/test/rules/M6-4-5/test.cpp index 84abf45278..9ba65c8e7b 100644 --- a/cpp/autosar/test/rules/M6-4-5/test.cpp +++ b/cpp/autosar/test/rules/M6-4-5/test.cpp @@ -40,6 +40,6 @@ void test_switchclause_termination2(int expression) { k = i; } default: // NON_COMPLIANT - ; + ; } } diff --git a/cpp/autosar/test/rules/M8-4-4/test.cpp b/cpp/autosar/test/rules/M8-4-4/test.cpp index aaf5ed055f..a1cd147aa8 100644 --- a/cpp/autosar/test/rules/M8-4-4/test.cpp +++ b/cpp/autosar/test/rules/M8-4-4/test.cpp @@ -25,7 +25,7 @@ void test_function_identifier_f2() { template static void Log(const F kF) {} -template static void LogFatal(const As &... rest) { +template static void LogFatal(const As &...rest) { Log([](const std::string &s) -> void {}); // COMPLIANT }