[LU-16123] checkpatch: comparisons with a constant or upper case identifier on the left Created: 29/Aug/22 Updated: 24/Sep/22 Resolved: 24/Sep/22 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Lustre 2.16.0 |
| Type: | Improvement | Priority: | Trivial |
| Reporter: | Arshad Hussain | Assignee: | Arshad Hussain |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Master |
||
| Rank (Obsolete): | 9223372036854775807 |
| Description |
|
checkpatch trows a warning if it finds an "UPPERCASE" on the left and side. According to the script/code it is to avoid cases like "foo + BAR < baz". However for our case "#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0)" this warning is false positive. This could be recreated as:
/* Fake values. For demo purpose */ #define SUM(a, b) (a + b) #define LUSTRE_VERSION_CODE 50 #define lustre_version_code 50 /* This case passes */ #if lustre_verison_code < SUM(10, 4) int x; #endif /* This case passes */ #if SUM(10, 4) < lustre_verison_code int x1; #endif /* This case passes */ #if SUM(10, 4) < LUSTRE_VERSION_CODE int x2; #endif /* This case FAILS. Proposed patch to fix this case */ #if LUSTRE_VERSION_CODE < SUM(10, 4) int x3; #endif
|
| Comments |
| Comment by Gerrit Updater [ 29/Aug/22 ] |
|
"Arshad Hussain <arshad.hussain@aeoncomputing.com>" uploaded a new patch: https://review.whamcloud.com/48375 |
| Comment by Gerrit Updater [ 24/Sep/22 ] |
|
"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/48375/ |
| Comment by Peter Jones [ 24/Sep/22 ] |
|
Landed for 2.16 |