From 3a23d2b5719cebdd81c915d21fad7971571a9fcf Mon Sep 17 00:00:00 2001 From: Eduardo Almeida Date: Sat, 27 Sep 2025 18:38:40 +0100 Subject: [PATCH] core: Remove clang-format guards not needed anymore --- src/core/model/attribute-accessor-helper.h | 9 -- src/core/model/object-map.h | 9 -- src/core/model/object-vector.h | 9 -- src/core/model/trace-source-accessor.h | 6 -- src/core/model/traced-value.h | 30 ------ src/core/test/callback-test-suite.cc | 64 ++++++------ src/core/test/simulator-test-suite.cc | 107 +++++++++------------ src/core/test/timer-test-suite.cc | 44 ++++----- 8 files changed, 92 insertions(+), 186 deletions(-) diff --git a/src/core/model/attribute-accessor-helper.h b/src/core/model/attribute-accessor-helper.h index da05d0ec2..1c652f3f0 100644 --- a/src/core/model/attribute-accessor-helper.h +++ b/src/core/model/attribute-accessor-helper.h @@ -233,12 +233,9 @@ class AccessorHelper : public AttributeAccessor * @param [in] memberVariable The address of the data member. * @returns The AttributeAccessor. */ -// clang-format off -// Clang-format guard needed for versions <= 18 template inline Ptr DoMakeAccessorHelperOne(U T::* memberVariable) -// clang-format on { /* AttributeAccessor implementation for a class member variable. */ class MemberVariable : public AccessorHelper @@ -248,10 +245,7 @@ DoMakeAccessorHelperOne(U T::* memberVariable) * Construct from a class data member address. * @param [in] memberVariable The class data member address. */ - // clang-format off - // Clang-format guard needed for versions <= 18 MemberVariable(U T::* memberVariable) - // clang-format on : AccessorHelper(), m_memberVariable(memberVariable) { @@ -286,10 +280,7 @@ DoMakeAccessorHelperOne(U T::* memberVariable) return true; } - // clang-format off - // Clang-format guard needed for versions <= 18 U T::* m_memberVariable; // Address of the class data member. - // clang-format on }; return Ptr(new MemberVariable(memberVariable), false); diff --git a/src/core/model/object-map.h b/src/core/model/object-map.h index 37c3e1a76..912fc683f 100644 --- a/src/core/model/object-map.h +++ b/src/core/model/object-map.h @@ -33,11 +33,8 @@ typedef ObjectPtrContainerValue ObjectMapValue; * MakeAccessorHelper implementation for ObjectVector. * @copydetails ns3::DoMakeAccessorHelperOne(U T::*) */ -// clang-format off -// Clang-format guard needed for versions <= 18 template Ptr MakeObjectMapAccessor(U T::* memberVariable); -// clang-format on // Documentation generated by print-introspected-doxygen.cc template @@ -63,12 +60,9 @@ Ptr MakeObjectMapAccessor(INDEX (T::*getN)() const, * Implementation of the templates declared above. ***************************************************************/ -// clang-format off -// Clang-format guard needed for versions <= 18 template Ptr MakeObjectMapAccessor(U T::* memberVector) -// clang-format on { struct MemberStdContainer : public ObjectPtrContainerAccessor { @@ -104,10 +98,7 @@ MakeObjectMapAccessor(U T::* memberVector) return nullptr; } - // clang-format off - // Clang-format guard needed for versions <= 18 U T::* m_memberVector; - // clang-format on }* spec = new MemberStdContainer(); spec->m_memberVector = memberVector; diff --git a/src/core/model/object-vector.h b/src/core/model/object-vector.h index fc71eaef6..01052c2f3 100644 --- a/src/core/model/object-vector.h +++ b/src/core/model/object-vector.h @@ -33,11 +33,8 @@ typedef ObjectPtrContainerValue ObjectVectorValue; * MakeAccessorHelper implementation for ObjectVector. * @copydetails ns3::DoMakeAccessorHelperOne(U T::*) */ -// clang-format off -// Clang-format guard needed for versions <= 18 template Ptr MakeObjectVectorAccessor(U T::* memberVariable); -// clang-format on // Documentation generated by print-introspected-doxygen.cc template @@ -63,12 +60,9 @@ Ptr MakeObjectVectorAccessor(INDEX (T::*getN)() const, * Implementation of the templates declared above. ***************************************************************/ -// clang-format off -// Clang-format guard needed for versions <= 18 template Ptr MakeObjectVectorAccessor(U T::* memberVector) -// clang-format on { struct MemberStdContainer : public ObjectPtrContainerAccessor { @@ -104,10 +98,7 @@ MakeObjectVectorAccessor(U T::* memberVector) return nullptr; } - // clang-format off - // Clang-format guard needed for versions <= 18 U T::* m_memberVector; - // clang-format on }* spec = new MemberStdContainer(); spec->m_memberVector = memberVector; diff --git a/src/core/model/trace-source-accessor.h b/src/core/model/trace-source-accessor.h index 81099b87b..687c10f69 100644 --- a/src/core/model/trace-source-accessor.h +++ b/src/core/model/trace-source-accessor.h @@ -136,12 +136,9 @@ namespace ns3 * @param [in] a The underlying data value. * @returns The TraceSourceAccessor */ -// clang-format off -// Clang-format guard needed for versions <= 18 template Ptr DoMakeTraceSourceAccessor(SOURCE T::* a) -// clang-format on { struct Accessor : public TraceSourceAccessor { @@ -189,10 +186,7 @@ DoMakeTraceSourceAccessor(SOURCE T::* a) return true; } - // clang-format off - // Clang-format guard needed for versions <= 18 SOURCE T::* m_source; - // clang-format on }* accessor = new Accessor(); accessor->m_source = a; diff --git a/src/core/model/traced-value.h b/src/core/model/traced-value.h index 9b423d3a6..c307f4d3c 100644 --- a/src/core/model/traced-value.h +++ b/src/core/model/traced-value.h @@ -501,13 +501,10 @@ operator>(const U& lhs, const TracedValue& rhs) * @returns The result of doing the operator on * the underlying values. */ -// clang-format off -// Clang-format guard needed for version 18 only template auto operator+(const TracedValue& lhs, const TracedValue& rhs) -> TracedValue -// clang-format on { TRACED_VALUE_DEBUG("x+x"); return TracedValue(lhs.Get() + rhs.Get()); @@ -532,13 +529,10 @@ operator+(const U& lhs, const TracedValue& rhs) -> TracedValue&lhs,const TracedValue&rhs) */ -// clang-format off -// Clang-format guard needed for version 18 only template auto operator-(const TracedValue& lhs, const TracedValue& rhs) -> TracedValue -// clang-format on { TRACED_VALUE_DEBUG("x-x"); return TracedValue(lhs.Get() - rhs.Get()); @@ -563,13 +557,10 @@ operator-(const U& lhs, const TracedValue& rhs) -> TracedValue&lhs,const TracedValue&rhs) */ -// clang-format off -// Clang-format guard needed for version 18 only template auto operator*(const TracedValue& lhs, const TracedValue& rhs) -> TracedValue -// clang-format on { TRACED_VALUE_DEBUG("x*x"); return TracedValue(lhs.Get() * rhs.Get()); @@ -594,13 +585,10 @@ operator*(const U& lhs, const TracedValue& rhs) -> TracedValue&lhs,const TracedValue&rhs) */ -// clang-format off -// Clang-format guard needed for version 18 only template auto operator/(const TracedValue& lhs, const TracedValue& rhs) -> TracedValue -// clang-format on { TRACED_VALUE_DEBUG("x/x"); return TracedValue(lhs.Get() / rhs.Get()); @@ -625,13 +613,10 @@ operator/(const U& lhs, const TracedValue& rhs) -> TracedValue&lhs,const TracedValue&rhs) */ -// clang-format off -// Clang-format guard needed for version 18 only template auto operator%(const TracedValue& lhs, const TracedValue& rhs) -> TracedValue -// clang-format on { TRACED_VALUE_DEBUG("x%x"); return TracedValue(lhs.Get() % rhs.Get()); @@ -656,13 +641,10 @@ operator%(const U& lhs, const TracedValue& rhs) -> TracedValue&lhs,const TracedValue&rhs) */ -// clang-format off -// Clang-format guard needed for version 18 only template auto operator^(const TracedValue& lhs, const TracedValue& rhs) -> TracedValue -// clang-format on { TRACED_VALUE_DEBUG("x^x"); return TracedValue(lhs.Get() ^ rhs.Get()); @@ -687,13 +669,10 @@ operator^(const U& lhs, const TracedValue& rhs) -> TracedValue&lhs,const TracedValue&rhs) */ -// clang-format off -// Clang-format guard needed for version 18 only template auto operator|(const TracedValue& lhs, const TracedValue& rhs) -> TracedValue -// clang-format on { TRACED_VALUE_DEBUG("x|x"); return TracedValue(lhs.Get() | rhs.Get()); @@ -718,13 +697,10 @@ operator|(const U& lhs, const TracedValue& rhs) -> TracedValue&lhs,const TracedValue&rhs) */ -// clang-format off -// Clang-format guard needed for version 18 only template auto operator&(const TracedValue& lhs, const TracedValue& rhs) -> TracedValue -// clang-format on { TRACED_VALUE_DEBUG("x&x"); return TracedValue(lhs.Get() & rhs.Get()); @@ -749,13 +725,10 @@ operator&(const U& lhs, const TracedValue& rhs) -> TracedValue&lhs,const TracedValue&rhs) */ -// clang-format off -// Clang-format guard needed for version 18 only template auto operator<<(const TracedValue& lhs, const TracedValue& rhs) -> TracedValue -// clang-format on { TRACED_VALUE_DEBUG("x<(lhs.Get() << rhs.Get()); @@ -780,13 +753,10 @@ operator<<(const U& lhs, const TracedValue& rhs) -> TracedValue&lhs,const TracedValue&rhs) */ -// clang-format off -// Clang-format guard needed for version 18 only template auto operator>>(const TracedValue& lhs, const TracedValue& rhs) -> TracedValue> rhs.Get())> -// clang-format on { TRACED_VALUE_DEBUG("x>>x"); return TracedValue> rhs.Get())>(lhs.Get() >> rhs.Get()); diff --git a/src/core/test/callback-test-suite.cc b/src/core/test/callback-test-suite.cc index d532833c1..029dccf30 100644 --- a/src/core/test/callback-test-suite.cc +++ b/src/core/test/callback-test-suite.cc @@ -1013,25 +1013,20 @@ class MakeCallbackTemplatesTestCase : public TestCase * Test function - does nothing. * @{ */ +void TestFZero() {}; +void TestFOne(int) {}; +void TestFTwo(int, int) {}; +void TestFThree(int, int, int) {}; +void TestFFour(int, int, int, int) {}; +void TestFFive(int, int, int, int, int) {}; +void TestFSix(int, int, int, int, int, int) {}; -// clang-format off - -void TestFZero() {} -void TestFOne(int) {} -void TestFTwo(int, int) {} -void TestFThree(int, int, int) {} -void TestFFour(int, int, int, int) {} -void TestFFive(int, int, int, int, int) {} -void TestFSix(int, int, int, int, int, int) {} - -void TestFROne(int&) {} -void TestFRTwo(int&, int&) {} -void TestFRThree(int&, int&, int&) {} -void TestFRFour(int&, int&, int&, int&) {} -void TestFRFive(int&, int&, int&, int&, int&) {} -void TestFRSix(int&, int&, int&, int&, int&, int&) {} - -// clang-format on +void TestFROne(int&) {}; +void TestFRTwo(int&, int&) {}; +void TestFRThree(int&, int&, int&) {}; +void TestFRFour(int&, int&, int&, int&) {}; +void TestFRFive(int&, int&, int&, int&, int&) {}; +void TestFRSix(int&, int&, int&, int&, int&, int&) {}; /** @} */ @@ -1080,25 +1075,20 @@ class CallbackTestClass : public CallbackTestParent * Test function - does nothing. * @{ */ - - // clang-format off - - void TestZero() {} - void TestOne(int) {} - void TestTwo(int, int) {} - void TestThree(int, int, int) {} - void TestFour(int, int, int, int) {} - void TestFive(int, int, int, int, int) {} - void TestSix(int, int, int, int, int, int) {} - void TestCZero() const {} - void TestCOne(int) const {} - void TestCTwo(int, int) const {} - void TestCThree(int, int, int) const {} - void TestCFour(int, int, int, int) const {} - void TestCFive(int, int, int, int, int) const {} - void TestCSix(int, int, int, int, int, int) const {} - - // clang-format on + void TestZero() {}; + void TestOne(int) {}; + void TestTwo(int, int) {}; + void TestThree(int, int, int) {}; + void TestFour(int, int, int, int) {}; + void TestFive(int, int, int, int, int) {}; + void TestSix(int, int, int, int, int, int) {}; + void TestCZero() const {}; + void TestCOne(int) const {}; + void TestCTwo(int, int) const {}; + void TestCThree(int, int, int) const {}; + void TestCFour(int, int, int, int) const {}; + void TestCFive(int, int, int, int, int) const {}; + void TestCSix(int, int, int, int, int, int) const {}; /** @} */ diff --git a/src/core/test/simulator-test-suite.cc b/src/core/test/simulator-test-suite.cc index 8a89b7436..396f6c664 100644 --- a/src/core/test/simulator-test-suite.cc +++ b/src/core/test/simulator-test-suite.cc @@ -235,45 +235,39 @@ class SimulatorTemplateTestCase : public TestCase * * @{ */ + void bar0() {}; + void bar1(int) {}; + void bar2(int, int) {}; + void bar3(int, int, int) {}; + void bar4(int, int, int, int) {}; + void bar5(int, int, int, int, int) {}; + void baz1(int&) {}; + void baz2(int&, int&) {}; + void baz3(int&, int&, int&) {}; + void baz4(int&, int&, int&, int&) {}; + void baz5(int&, int&, int&, int&, int&) {}; + void cbaz1(const int&) {}; + void cbaz2(const int&, const int&) {}; + void cbaz3(const int&, const int&, const int&) {}; + void cbaz4(const int&, const int&, const int&, const int&) {}; + void cbaz5(const int&, const int&, const int&, const int&, const int&) {}; - // clang-format off - - void bar0() {} - void bar1(int) {} - void bar2(int, int) {} - void bar3(int, int, int) {} - void bar4(int, int, int, int) {} - void bar5(int, int, int, int, int) {} - void baz1(int&) {} - void baz2(int&, int&) {} - void baz3(int&, int&, int&) {} - void baz4(int&, int&, int&, int&) {} - void baz5(int&, int&, int&, int&, int&) {} - void cbaz1(const int&) {} - void cbaz2(const int&, const int&) {} - void cbaz3(const int&, const int&, const int&) {} - void cbaz4(const int&, const int&, const int&, const int&) {} - void cbaz5(const int&, const int&, const int&, const int&, const int&) {} - - void bar0c() const {} - void bar1c(int) const {} - void bar2c(int, int) const {} - void bar3c(int, int, int) const {} - void bar4c(int, int, int, int) const {} - void bar5c(int, int, int, int, int) const {} - void baz1c(int&) const {} - void baz2c(int&, int&) const {} - void baz3c(int&, int&, int&) const {} - void baz4c(int&, int&, int&, int&) const {} - void baz5c(int&, int&, int&, int&, int&) const {} - void cbaz1c(const int&) const {} - void cbaz2c(const int&, const int&) const {} - void cbaz3c(const int&, const int&, const int&) const {} - void cbaz4c(const int&, const int&, const int&, const int&) const {} - void cbaz5c(const int&, const int&, const int&, const int&, const int&) const {} - - // clang-format on - + void bar0c() const {}; + void bar1c(int) const {}; + void bar2c(int, int) const {}; + void bar3c(int, int, int) const {}; + void bar4c(int, int, int, int) const {}; + void bar5c(int, int, int, int, int) const {}; + void baz1c(int&) const {}; + void baz2c(int&, int&) const {}; + void baz3c(int&, int&, int&) const {}; + void baz4c(int&, int&, int&, int&) const {}; + void baz5c(int&, int&, int&, int&, int&) const {}; + void cbaz1c(const int&) const {}; + void cbaz2c(const int&, const int&) const {}; + void cbaz3c(const int&, const int&, const int&) const {}; + void cbaz4c(const int&, const int&, const int&, const int&) const {}; + void cbaz5c(const int&, const int&, const int&, const int&, const int&) const {}; /** @} */ }; @@ -282,27 +276,22 @@ class SimulatorTemplateTestCase : public TestCase * * @{ */ - -// clang-format off - -static void foo0() {} -static void foo1(int) {} -static void foo2(int, int) {} -static void foo3(int, int, int) {} -static void foo4(int, int, int, int) {} -static void foo5(int, int, int, int, int) {} -static void ber1(int&) {} -static void ber2(int&, int&) {} -static void ber3(int&, int&, int&) {} -static void ber4(int&, int&, int&, int&) {} -static void ber5(int&, int&, int&, int&, int&) {} -static void cber1(const int&) {} -static void cber2(const int&, const int&) {} -static void cber3(const int&, const int&, const int&) {} -static void cber4(const int&, const int&, const int&, const int&) {} -static void cber5(const int&, const int&, const int&, const int&, const int&) {} - -// clang-format on +static void foo0() {}; +static void foo1(int) {}; +static void foo2(int, int) {}; +static void foo3(int, int, int) {}; +static void foo4(int, int, int, int) {}; +static void foo5(int, int, int, int, int) {}; +static void ber1(int&) {}; +static void ber2(int&, int&) {}; +static void ber3(int&, int&, int&) {}; +static void ber4(int&, int&, int&, int&) {}; +static void ber5(int&, int&, int&, int&, int&) {}; +static void cber1(const int&) {}; +static void cber2(const int&, const int&) {}; +static void cber3(const int&, const int&, const int&) {}; +static void cber4(const int&, const int&, const int&, const int&) {}; +static void cber5(const int&, const int&, const int&, const int&, const int&) {}; /** @} */ diff --git a/src/core/test/timer-test-suite.cc b/src/core/test/timer-test-suite.cc index 43019271a..f2981b817 100644 --- a/src/core/test/timer-test-suite.cc +++ b/src/core/test/timer-test-suite.cc @@ -23,26 +23,20 @@ namespace { - -// clang-format off - /// Function with one int parameter. -void bari(int) {} +void bari(int) {}; /// Function with two int parameters. -void bar2i(int, int) {} +void bar2i(int, int) {}; /// Function with three int parameters. -void bar3i(int, int, int) {} +void bar3i(int, int, int) {}; /// Function with four int parameters. -void bar4i(int, int, int, int) {} +void bar4i(int, int, int, int) {}; /// Function with five int parameters. -void bar5i(int, int, int, int, int) {} +void bar5i(int, int, int, int, int) {}; /// Function with one const int reference parameter. -void barcir(const int&) {} +void barcir(const int&) {}; /// Function with one int reference parameter. -void barir(int&) {} - -// clang-format on - +void barir(int&) {}; } // anonymous namespace using namespace ns3; @@ -110,30 +104,26 @@ class TimerTemplateTestCase : public TestCase void DoRun() override; void DoTeardown() override; - // clang-format off - /// Member function with one int parameter. - void bazi(int) {} + void bazi(int) {}; /// Member function with two int parameters. - void baz2i(int, int) {} + void baz2i(int, int) {}; /// Member function with three int parameters. - void baz3i(int, int, int) {} + void baz3i(int, int, int) {}; /// Member function with four int parameters. - void baz4i(int, int, int, int) {} + void baz4i(int, int, int, int) {}; /// Member function with five int parameters. - void baz5i(int, int, int, int, int) {} + void baz5i(int, int, int, int, int) {}; /// Member function with six int parameters. - void baz6i(int, int, int, int, int, int) {} + void baz6i(int, int, int, int, int, int) {}; /// Member function with one const int reference parameter. - void bazcir(const int&) {} + void bazcir(const int&) {}; /// Member function with one int reference parameter. - void bazir(int&) {} + void bazir(int&) {}; /// Member function with one int pointer parameter. - void bazip(int*) {} + void bazip(int*) {}; /// Member function with one const int pointer parameter. - void bazcip(const int*) {} - - // clang-format on + void bazcip(const int*) {}; }; TimerTemplateTestCase::TimerTemplateTestCase()