[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
Subject: LU-16123 checkpatch: Suppress false warning
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 68100589eb96c2f546dd9eed64fa657f74cc7e63

Comment by Gerrit Updater [ 24/Sep/22 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/48375/
Subject: LU-16123 checkpatch: Suppress false warning
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 3201740760d241dee935e4a66935b1bc81ac6380

Comment by Peter Jones [ 24/Sep/22 ]

Landed for 2.16

Generated at Sat Feb 10 03:24:12 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.