[PATCH] D17387: Add check for CERT FLP30-C

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 19 07:07:15 PST 2016


alexfh added a comment.

LG


================
Comment at: test/clang-tidy/cert-flp30-c.c:6
@@ +5,3 @@
+void func(void) {
+  // CHECK-MESSAGES: :[[@LINE+1]]:37: warning: loop induction expression should not have floating-point type [cert-flp30-c]
+  for (float x = 0.1f; x <= 1.0f; x += 0.1f) {
----------------
aaron.ballman wrote:
> hokein wrote:
> > I see in most of testcases, they are using `[[@LINE-1]]` instead of `[[@LINE+1]]`. We'd better follow the `[[@LINE+1]]` way here.
> I've changed to using -1 instead of +1, but I don't think we have a hard and fast rule on location aside from "whatever makes the most sense." Given the compound blocks, I personally think +1 is more clear than -1, but meh.
Yep, I don't think we're trying to be consistent with placing check lines before or after the checked location. Not that it matters much.


http://reviews.llvm.org/D17387





More information about the cfe-commits mailing list