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
This commit is contained in:
Chih-Hung Hsieh 2023-01-11 14:43:33 -08:00
parent e7a3e4e9c8
commit b6aaca1e06

View file

@ -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;