core: Remove clang-format guards not needed anymore

This commit is contained in:
Eduardo Almeida
2025-09-27 18:38:40 +01:00
parent 989e36fe82
commit 3a23d2b571
8 changed files with 92 additions and 186 deletions

View File

@@ -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 <typename V, typename T, typename U>
inline Ptr<const AttributeAccessor>
DoMakeAccessorHelperOne(U T::* memberVariable)
// clang-format on
{
/* AttributeAccessor implementation for a class member variable. */
class MemberVariable : public AccessorHelper<T, V>
@@ -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<T, V>(),
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<const AttributeAccessor>(new MemberVariable(memberVariable), false);

View File

@@ -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 <typename T, typename U>
Ptr<const AttributeAccessor> MakeObjectMapAccessor(U T::* memberVariable);
// clang-format on
// Documentation generated by print-introspected-doxygen.cc
template <typename T>
@@ -63,12 +60,9 @@ Ptr<const AttributeAccessor> MakeObjectMapAccessor(INDEX (T::*getN)() const,
* Implementation of the templates declared above.
***************************************************************/
// clang-format off
// Clang-format guard needed for versions <= 18
template <typename T, typename U>
Ptr<const AttributeAccessor>
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;

View File

@@ -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 <typename T, typename U>
Ptr<const AttributeAccessor> MakeObjectVectorAccessor(U T::* memberVariable);
// clang-format on
// Documentation generated by print-introspected-doxygen.cc
template <typename T>
@@ -63,12 +60,9 @@ Ptr<const AttributeAccessor> MakeObjectVectorAccessor(INDEX (T::*getN)() const,
* Implementation of the templates declared above.
***************************************************************/
// clang-format off
// Clang-format guard needed for versions <= 18
template <typename T, typename U>
Ptr<const AttributeAccessor>
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;

View File

@@ -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 <typename T, typename SOURCE>
Ptr<const TraceSourceAccessor>
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;

View File

@@ -501,13 +501,10 @@ operator>(const U& lhs, const TracedValue<T>& rhs)
* @returns The result of doing the operator on
* the underlying values.
*/
// clang-format off
// Clang-format guard needed for version 18 only
template <typename T, typename U>
auto
operator+(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
-> TracedValue<decltype(lhs.Get() + rhs.Get())>
// clang-format on
{
TRACED_VALUE_DEBUG("x+x");
return TracedValue<decltype(lhs.Get() + rhs.Get())>(lhs.Get() + rhs.Get());
@@ -532,13 +529,10 @@ operator+(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs +
}
/** @copydoc operator+(const TracedValue<T>&lhs,const TracedValue<U>&rhs) */
// clang-format off
// Clang-format guard needed for version 18 only
template <typename T, typename U>
auto
operator-(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
-> TracedValue<decltype(lhs.Get() - rhs.Get())>
// clang-format on
{
TRACED_VALUE_DEBUG("x-x");
return TracedValue<decltype(lhs.Get() - rhs.Get())>(lhs.Get() - rhs.Get());
@@ -563,13 +557,10 @@ operator-(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs -
}
/** @copydoc operator+(const TracedValue<T>&lhs,const TracedValue<U>&rhs) */
// clang-format off
// Clang-format guard needed for version 18 only
template <typename T, typename U>
auto
operator*(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
-> TracedValue<decltype(lhs.Get() * rhs.Get())>
// clang-format on
{
TRACED_VALUE_DEBUG("x*x");
return TracedValue<decltype(lhs.Get() * rhs.Get())>(lhs.Get() * rhs.Get());
@@ -594,13 +585,10 @@ operator*(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs +
}
/** @copydoc operator+(const TracedValue<T>&lhs,const TracedValue<U>&rhs) */
// clang-format off
// Clang-format guard needed for version 18 only
template <typename T, typename U>
auto
operator/(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
-> TracedValue<decltype(lhs.Get() / rhs.Get())>
// clang-format on
{
TRACED_VALUE_DEBUG("x/x");
return TracedValue<decltype(lhs.Get() / rhs.Get())>(lhs.Get() / rhs.Get());
@@ -625,13 +613,10 @@ operator/(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs /
}
/** @copydoc operator+(const TracedValue<T>&lhs,const TracedValue<U>&rhs) */
// clang-format off
// Clang-format guard needed for version 18 only
template <typename T, typename U>
auto
operator%(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
-> TracedValue<decltype(lhs.Get() % rhs.Get())>
// clang-format on
{
TRACED_VALUE_DEBUG("x%x");
return TracedValue<decltype(lhs.Get() % rhs.Get())>(lhs.Get() % rhs.Get());
@@ -656,13 +641,10 @@ operator%(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs %
}
/** @copydoc operator+(const TracedValue<T>&lhs,const TracedValue<U>&rhs) */
// clang-format off
// Clang-format guard needed for version 18 only
template <typename T, typename U>
auto
operator^(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
-> TracedValue<decltype(lhs.Get() ^ rhs.Get())>
// clang-format on
{
TRACED_VALUE_DEBUG("x^x");
return TracedValue<decltype(lhs.Get() ^ rhs.Get())>(lhs.Get() ^ rhs.Get());
@@ -687,13 +669,10 @@ operator^(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs ^
}
/** @copydoc operator+(const TracedValue<T>&lhs,const TracedValue<U>&rhs) */
// clang-format off
// Clang-format guard needed for version 18 only
template <typename T, typename U>
auto
operator|(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
-> TracedValue<decltype(lhs.Get() | rhs.Get())>
// clang-format on
{
TRACED_VALUE_DEBUG("x|x");
return TracedValue<decltype(lhs.Get() | rhs.Get())>(lhs.Get() | rhs.Get());
@@ -718,13 +697,10 @@ operator|(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs |
}
/** @copydoc operator+(const TracedValue<T>&lhs,const TracedValue<U>&rhs) */
// clang-format off
// Clang-format guard needed for version 18 only
template <typename T, typename U>
auto
operator&(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
-> TracedValue<decltype(lhs.Get() & rhs.Get())>
// clang-format on
{
TRACED_VALUE_DEBUG("x&x");
return TracedValue<decltype(lhs.Get() & rhs.Get())>(lhs.Get() & rhs.Get());
@@ -749,13 +725,10 @@ operator&(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs &
}
/** @copydoc operator+(const TracedValue<T>&lhs,const TracedValue<U>&rhs) */
// clang-format off
// Clang-format guard needed for version 18 only
template <typename T, typename U>
auto
operator<<(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
-> TracedValue<decltype(lhs.Get() << rhs.Get())>
// clang-format on
{
TRACED_VALUE_DEBUG("x<<x");
return TracedValue<decltype(lhs.Get() << rhs.Get())>(lhs.Get() << rhs.Get());
@@ -780,13 +753,10 @@ operator<<(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs
}
/** @copydoc operator+(const TracedValue<T>&lhs,const TracedValue<U>&rhs) */
// clang-format off
// Clang-format guard needed for version 18 only
template <typename T, typename U>
auto
operator>>(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
-> TracedValue<decltype(lhs.Get() >> rhs.Get())>
// clang-format on
{
TRACED_VALUE_DEBUG("x>>x");
return TracedValue<decltype(lhs.Get() >> rhs.Get())>(lhs.Get() >> rhs.Get());

View File

@@ -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 {};
/** @} */

View File

@@ -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&) {};
/** @} */

View File

@@ -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()