]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
contrib: Fix check_GNU_style.py for some .opt issues [PR125275]
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Mon, 11 May 2026 21:34:58 +0000 (14:34 -0700)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Mon, 11 May 2026 23:02:58 +0000 (16:02 -0700)
I noticed while reviewing a patch check_GNU_style.py would fail
for the .opt files in a few ways. First greater than 80 columns
is expected. Second is the space after the "function".
Both of these are not useful for .opt so let's ignore then here.

PR other/125275
contrib/ChangeLog:

* check_GNU_style_lib.py (LineLengthCheck.check): Ignore
filenames that end with .opt.
(FunctionParenthesisCheck.check): Likewise.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
contrib/check_GNU_style_lib.py

index bcfe459b4df458a3b233f3d3c0a4d9421275458d..a7c4e2b0bd5567d7c38f6e51816b03dd094ce9c3 100755 (executable)
@@ -82,7 +82,7 @@ class LineLengthCheck:
 
     def check(self, filename, lineno, line):
         line_expanded = line.replace('\t', self.expanded_tab)
-        if len(line_expanded) > self.limit:
+        if not filename.endswith(".opt") and len(line_expanded) > self.limit:
             return CheckError(filename, lineno,
                 line_expanded[:self.limit]
                     + error_string(line_expanded[self.limit:]),
@@ -167,6 +167,9 @@ class FunctionParenthesisCheck:
         self.re = re.compile(r'\w(\s{2,})?(\()')
 
     def check(self, filename, lineno, line):
+        if filename.endswith(".opt"):
+            return None
+
         if '#define' in line:
             return None