From b34e5426a5ace4f54c75e2c52cf425349a457439 Mon Sep 17 00:00:00 2001 From: Eduardo Almeida Date: Mon, 5 Sep 2022 01:51:52 +0100 Subject: [PATCH] Add clang-tidy guards --- src/core/examples/length-example.cc | 2 ++ src/core/model/cairo-wideint-private.h | 2 ++ src/core/model/cairo-wideint.c | 2 ++ src/core/model/hash-fnv.cc | 2 ++ src/core/model/hash-murmur3.cc | 2 ++ src/core/test/int64x64-test-suite.cc | 9 ++++++++- src/nix-vector-routing/model/nix-vector-routing.h | 4 ++++ 7 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/core/examples/length-example.cc b/src/core/examples/length-example.cc index 902da0159..de59d4045 100644 --- a/src/core/examples/length-example.cc +++ b/src/core/examples/length-example.cc @@ -113,6 +113,7 @@ void EqualityOperators () Length twoMeter = Meters (2); Length threeMeter = Meters (3); + // NOLINTBEGIN(misc-redundant-expression) std::cout << "\n" << "Comparison Operations:\n" << std::boolalpha << "Equality: " << oneMeter << " == " << oneMeter << " is " << (oneMeter == oneMeter) @@ -134,6 +135,7 @@ void EqualityOperators () << "Greater: " << oneMeter << " > " << twoMeter << " is " << (oneMeter > twoMeter) << "\n" << "Greater: " << threeMeter << " > " << oneMeter << " is " << (threeMeter > oneMeter) << std::endl; + // NOLINTEND(misc-redundant-expression) } /** diff --git a/src/core/model/cairo-wideint-private.h b/src/core/model/cairo-wideint-private.h index 77c3cdeb7..16e394dd3 100644 --- a/src/core/model/cairo-wideint-private.h +++ b/src/core/model/cairo-wideint-private.h @@ -49,6 +49,7 @@ // extern const char * cairo_impl64; // extern const char * cairo_impl128; +// NOLINTBEGIN // clang-format off /*for compatibility with MacOS and Cygwin*/ @@ -361,5 +362,6 @@ _cairo_int_96by64_32x64_divrem (cairo_int128_t num, #endif // clang-format on + // NOLINTEND #endif /* CAIRO_WIDEINT_H */ diff --git a/src/core/model/cairo-wideint.c b/src/core/model/cairo-wideint.c index 286fbd56b..852a7a1fb 100644 --- a/src/core/model/cairo-wideint.c +++ b/src/core/model/cairo-wideint.c @@ -40,6 +40,7 @@ * Implementation of the cairo_x functions which implement high precision arithmetic. */ +// NOLINTBEGIN // clang-format off #if HAVE_UINT64_T @@ -827,3 +828,4 @@ _cairo_int_96by64_32x64_divrem (cairo_int128_t num, cairo_int64_t den) } // clang-format on +// NOLINTEND diff --git a/src/core/model/hash-fnv.cc b/src/core/model/hash-fnv.cc index 2ebaf9ed4..475005752 100644 --- a/src/core/model/hash-fnv.cc +++ b/src/core/model/hash-fnv.cc @@ -69,6 +69,7 @@ extern "C" { // Changes from FNV distribution are marked with `//PDB' // +// NOLINTBEGIN // clang-format off /* @@ -728,6 +729,7 @@ fnv_64a_str(char *str, Fnv64_t hval) } // clang-format on +// NOLINTEND } /* extern "C" */ diff --git a/src/core/model/hash-murmur3.cc b/src/core/model/hash-murmur3.cc index 92cf59fbc..0ee2764d6 100644 --- a/src/core/model/hash-murmur3.cc +++ b/src/core/model/hash-murmur3.cc @@ -72,6 +72,7 @@ namespace Murmur3Implementation { // Adapted from http://code.google.com/p/smhasher/ +// NOLINTBEGIN // clang-format off // @@ -506,6 +507,7 @@ void MurmurHash3_x64_128 ( const void * key, const std::size_t len, } // clang-format on +// NOLINTEND #undef BIG_CONSTANT diff --git a/src/core/test/int64x64-test-suite.cc b/src/core/test/int64x64-test-suite.cc index 19be32867..745fac670 100644 --- a/src/core/test/int64x64-test-suite.cc +++ b/src/core/test/int64x64-test-suite.cc @@ -498,6 +498,7 @@ Int64x64ArithmeticTestCase::DoRun (void) std::cout << GetParent ()->GetName () << " Arithmetic: " << GetName () << std::endl; + // NOLINTBEGIN(misc-redundant-expression) Check ( 0, zero - zero, zero ); Check ( 1, zero - one, -one ); Check ( 2, one - one, zero ); @@ -522,6 +523,7 @@ Int64x64ArithmeticTestCase::DoRun (void) Check (19, (-one ) * (-one ), one ); Check (20, (two * thre ) / thre, two ); + // NOLINTEND(misc-redundant-expression) const int64x64_t frac = int64x64_t (0, 0xc000000000000000ULL); // 0.75 const int64x64_t fplf2 = frac + frac * frac; // 1.3125 @@ -534,9 +536,9 @@ Int64x64ArithmeticTestCase::DoRun (void) const int64x64_t twof = two + frac; const int64x64_t thref = thre + frac; + // NOLINTBEGIN(misc-redundant-expression) Check (23, zerof, frac); - Check (24, zerof - zerof, zero ); Check (25, zerof - onef, -one ); Check (26, onef - onef, zero ); @@ -562,6 +564,7 @@ Int64x64ArithmeticTestCase::DoRun (void) Check (43, onef * onef, onef + fplf2 ); Check (44, onef * (-onef), -onef - fplf2 ); Check (45, (-onef) * (-onef), onef + fplf2 ); + // NOLINTEND(misc-redundant-expression) // Multiplication followed by division is exact: @@ -812,6 +815,7 @@ Int64x64Bug1786TestCase::DoRun (void) // because operator<< truncates the last output digit, // instead of rounding. + // NOLINTBEGIN(misc-redundant-expression) // clang-format off Check( 1ULL, "+0.0000000000000000000542"); Check( 2ULL, "+0.0000000000000000001084"); @@ -874,6 +878,7 @@ Int64x64Bug1786TestCase::DoRun (void) Check(0xFFFFFFFFFFFFFFFEULL, "+0.9999999999999999998916", tolerance); Check(0xFFFFFFFFFFFFFFFFULL, "+0.9999999999999999999458", tolerance); // clang-format on + // NOLINTEND(misc-redundant-expression) } @@ -932,6 +937,7 @@ Int64x64CompareTestCase::DoRun (void) const int64x64_t monef = mone - frac; const int64x64_t mtwof = mtwo - frac; + // NOLINTBEGIN(misc-redundant-expression) Check ( zerof == zerof, true, "equality, zero"); Check ( onef == onef, true, "equality, positive"); Check ( mtwof == mtwof, true, "equality, negative"); @@ -990,6 +996,7 @@ Int64x64CompareTestCase::DoRun (void) Check ( (!one) == false, true, "!one == false"); Check ( (+onef) == onef, true, "unary positive"); Check ( (-onef) == monef, true, "unary negative"); + // NOLINTEND(misc-redundant-expression) } diff --git a/src/nix-vector-routing/model/nix-vector-routing.h b/src/nix-vector-routing/model/nix-vector-routing.h index 1eb6be117..92030bb07 100644 --- a/src/nix-vector-routing/model/nix-vector-routing.h +++ b/src/nix-vector-routing/model/nix-vector-routing.h @@ -45,6 +45,8 @@ #include #include +// NOLINTBEGIN(modernize-use-override) + namespace ns3 { /** @@ -497,4 +499,6 @@ typedef NixVectorRouting Ipv4NixVectorRouting; typedef NixVectorRouting Ipv6NixVectorRouting; } // namespace ns3 +// NOLINTEND(modernize-use-override) + #endif /* NIX_VECTOR_ROUTING_H */