1// RUN: %check_clang_tidy %s cert-flp30-c %t
2
3float g(void);
4
5void func(void) {
6 for (float x = 0.1f; x <= 1.0f; x += 0.1f) {}
7 // CHECK-MESSAGES: :[[@LINE-1]]:37: warning: loop induction expression should not have floating-point type [cert-flp30-c]
8
9 float f = 1.0f;
10 for (; f > 0; --f) {}
11 // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: loop induction expression
12
13 for (;;g()) {}
14 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: loop induction expression
15
16 for (int i = 0; i < 10; i += 1.0f) {}
17
18 for (int i = 0; i < 10; ++i) {}
19}
20

source code of clang-tools-extra/test/clang-tidy/checkers/cert/flp30-c.c