This patch adds a check for the CERT secure coding rule: FLP30-C. Do not use floating-point variables as loop counters. It flags any for loop induction expression that has floating-point type.
Diff Detail
Event Timeline
LGTM with one nit.
test/clang-tidy/cert-flp30-c.c | ||
---|---|---|
6 | I see in most of testcases, they are using [[@LINE-1]] instead of [[@LINE+1]]. We'd better follow the [[@LINE+1]] way here. |
Thanks! I've commit in r261324.
test/clang-tidy/cert-flp30-c.c | ||
---|---|---|
6 | 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. |
LG
test/clang-tidy/cert-flp30-c.c | ||
---|---|---|
6 | 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. |
I see in most of testcases, they are using [[@LINE-1]] instead of [[@LINE+1]]. We'd better follow the [[@LINE+1]] way here.