From b6aaca1e06a22e17e4791db05f5c7c01b7d844a3 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Wed, 11 Jan 2023 14:43:33 -0800 Subject: [PATCH] Suppress clang-analyzer-security.FloatLoopCounter warnings * Suppress also the alias check name cert-flp30-c, which is given at the 2nd line of the for-loop. * Leave comment in code for code owners to rewrite the loop with integer counters. Bug: 265171053 Test: presubmit; tidy-device-google_subset Change-Id: I6e9bee2ea28164a6d93cb2538d955e002663bffd --- vibrator/cs40l26/Vibrator.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vibrator/cs40l26/Vibrator.cpp b/vibrator/cs40l26/Vibrator.cpp index 7ccaad8..e4157c9 100644 --- a/vibrator/cs40l26/Vibrator.cpp +++ b/vibrator/cs40l26/Vibrator.cpp @@ -837,8 +837,11 @@ void Vibrator::createPwleMaxLevelLimitMap() { pwleMaxLevelLimitMapIdx = (itr0->first - PWLE_FREQUENCY_MIN_HZ) / PWLE_FREQUENCY_RESOLUTION_HZ; + // FixLater: avoid floating point loop counters + // NOLINTBEGIN(clang-analyzer-security.FloatLoopCounter,cert-flp30-c) for (float xp = x0; xp < (x1 + PWLE_FREQUENCY_RESOLUTION_HZ); xp += PWLE_FREQUENCY_RESOLUTION_HZ) { + // NOLINTEND(clang-analyzer-security.FloatLoopCounter,cert-flp30-c) float yp = y0 + ratioOfXY * (xp - x0); pwleMaxLevelLimitMap[pwleMaxLevelLimitMapIdx++] = yp;