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
  • linux
  • scripts
  • kernel-doc
Find file BlameHistoryPermalink
  • Yujie Liu's avatar
    scripts/kernel-doc: Fix the regex for matching -Werror flag · cf63348b
    Yujie Liu authored Oct 30, 2023
    Swarup reported a "make htmldocs" warning:
    
      Variable length lookbehind is experimental in regex;
      marked by <-- HERE in m/(?<=^|\s)-Werror(?=$|\s)
      <-- HERE / at ./scripts/kernel-doc line 188.
    
    Akira managed to reproduce it by perl v5.34.0.
    
    On second thought, it is not necessary to have the complicated
    "lookahead and lookbehind" things, and the regex can be simplified.
    
    Generally, the kernel-doc warnings should be considered as errors only
    when "-Werror" flag is set in KCFLAGS, but not when
    "-Werror=<diagnostic-type>" is set, which means there needs to be a
    space or start of string before "-Werror", and a space or end of string
    after "-Werror".
    
    The following cases have been tested to work as expected:
    
    * kernel-doc warnings are considered as errors:
    
      $ KCFLAGS="-Werror" make W=1
      $ KCFLAGS="-Wcomment -Werror" make W=1
      $ KCFLAGS="-Werror -Wundef" make W=1
      $ KCFLAGS="-Wcomment -Werror -Wundef" make W=1
    
    * kernel-doc warnings remain as warnings:
    
      $ KCFLAGS="-Werror=return-type" make W=1
      $ KCFLAGS="-Wcomment -Werror=return-type" make W=1
      $ KCFLAGS="-Werror=return-type -Wundef" make W=1
      $ KCFLAGS="-Wcomment -Werror=return-type -Wundef" make W=1
    
    The "Variable length lookbehind is experimental in regex" warning is
    also resolved by this patch.
    
    Fixes: 91f950e8
    
     ("scripts/kernel-doc: match -Werror flag strictly")
    Reported-by: default avatarSwarup Laxman Kotiaklapudi <swarupkotikalapudi@gmail.com>
    Signed-off-by: default avatarYujie Liu <yujie.liu@intel.com>
    Closes: https://lore.kernel.org/r/20231028182231.123996-1-swarupkotikalapudi@gmail.com/
    
    
    Reviewed-by: default avatarAkira Yokosawa <akiyks@gmail.com>
    Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
    Link: https://lore.kernel.org/r/20231030085404.3343403-1-yujie.liu@intel.com
    cf63348b
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7