Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
You need to sign in or sign up before continuing.
  • linux
  • scripts
  • checkpatch.pl
Find file BlameHistoryPermalink
  • Joe Perches's avatar
    checkpatch: suggest using min_t or max_t · 7d2367af
    Joe Perches authored Jul 25, 2011
    
    
    A common issue with min() or max() is using a cast on one or both of the
    arguments when using min_t/max_t could be better.
    
    Add cast detection to uses of min/max and suggest an appropriate use of
    min_t or max_t instead.
    
    Caveat:  This only works for min() or max() on a single line.
             It does not find min() or max() split across multiple lines.
    
    This does find:
    	min((u32)foo, bar);
    But it does not find:
    	max((unsigned long)foo,
    	    bar);
    
    Suggested-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarJoe Perches <joe@perches.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    7d2367af
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7