diff options
author | Joe Perches <[email protected]> | 2015-09-09 15:37:58 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2015-09-10 13:29:01 -0700 |
commit | c5595fa2f1ce3c1a74dbd2ddc949257e80d81dc0 (patch) | |
tree | 3351ed229a4f64df859ad49de118210dd50fa367 /tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py | |
parent | 54507b5183cc4f8e4f1a58a312e1f30c130658b7 (diff) |
checkpatch: add constant comparison on left side test
"CONST <comparison> variable" checks like:
if (NULL != foo)
and
while (0 < bar(...))
where a constant (or what appears to be a constant like an upper case
identifier) is on the left of a comparison are generally preferred to be
written using the constant on the right side like:
if (foo != NULL)
and
while (bar(...) > 0)
Add a test for this.
Add a --fix option too, but only do it when the code is immediately
surrounded by parentheses to avoid misfixing things like "(0 < bar() +
constant)"
Signed-off-by: Joe Perches <[email protected]>
Cc: Nicolas Morey Chaisemartin <[email protected]>
Cc: Viresh Kumar <[email protected]>
Cc: Dan Carpenter <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py')
0 files changed, 0 insertions, 0 deletions