Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aadacbb2 authored by Chih-Hung Hsieh's avatar Chih-Hung Hsieh
Browse files

Suppress clang-analyzer-security.FloatLoopCounter warnings

* Suppress also the alias check name cert-flp30-c.
* These loops don't care about the actual float values,
  just about the behavior for many values over a known range.

Bug: 265171053
Test: presubmit; tidy-frameworks-native-libs-ui-tests_subset
Change-Id: I8c5541d517e27a555998b89c57d5020c789f964f
parent dc44a31e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ TEST_F(ColorSpaceTest, TransferFunctions) {
    EXPECT_NEAR(1.0f, sRGB.getEOTF()(1.0f), 1e-6f);
    EXPECT_NEAR(1.0f, sRGB.getOETF()(1.0f), 1e-6f);

    // NOLINTNEXTLINE(clang-analyzer-security.FloatLoopCounter,cert-flp30-c)
    for (float v = 0.0f; v <= 0.5f; v += 1e-3f) {
        ASSERT_TRUE(v >= sRGB.getEOTF()(v));
        ASSERT_TRUE(v <= sRGB.getOETF()(v));
@@ -118,6 +119,7 @@ TEST_F(ColorSpaceTest, TransferFunctions) {

    float previousEOTF = std::numeric_limits<float>::lowest();
    float previousOETF = std::numeric_limits<float>::lowest();
    // NOLINTNEXTLINE(clang-analyzer-security.FloatLoopCounter,cert-flp30-c)
    for (float v = 0.0f; v <= 1.0f; v += 1e-3f) {
        ASSERT_TRUE(previousEOTF < sRGB.getEOTF()(v));
        previousEOTF = sRGB.getEOTF()(v);
@@ -131,6 +133,7 @@ TEST_F(ColorSpaceTest, TransferFunctions) {
          {0.3127f, 0.3290f}
          // linear transfer functions
    );
    // NOLINTNEXTLINE(clang-analyzer-security.FloatLoopCounter,cert-flp30-c)
    for (float v = 0.0f; v <= 1.0f; v += 1e-3f) {
        ASSERT_EQ(v, sRGB2.getEOTF()(v));
        ASSERT_EQ(v, sRGB2.getOETF()(v));