On 2026-07-28 22:40, Andrea Pinski wrote:
On Tue, Jul 28, 2026 at 1:28 PM Torbjörn SVENSSON
<[email protected]> wrote:
Ok for trunk?
--
When running the style checker, it can incorrectly, report an error for
too wide lines if the tab is not at the start of the line.
In below example, I'm using ^I to visualise a tab.
bool begun;^I^I^I^I/* True if begin initialized output state. */
I am not sure we should have any tabs not in the front.
The only exception is inside multi-line macros.Or with a struct
definition or variable definition with its initializers.
I know this script is not perfect at detecting all of the issues so ...
Ok. There appears to be a lot of places where tabs are used between the
statement on the line and some comment at the end of the line.
I'll push this to, at least, properly calculate the length of such line, even
if the construct should probably be avoided.
Without this patch, the line above is reported to be longer than 80
characters, but it's only 78 characters long. With the patch, its
correct length is used and the check passes.
contrib/ChangeLog:
* check_GNU_style_lib.py: Use visual tab size rather than
blindly using 8 spaces as replacement.
Ok.
Pushed as r17-2772-g5dfea15a443438.
Kind regards,
Torbjörn
Signed-off-by: Torbjörn SVENSSON <[email protected]>
---
contrib/check_GNU_style_lib.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/contrib/check_GNU_style_lib.py b/contrib/check_GNU_style_lib.py
index a7c4e2b0bd5..d057faa51cd 100755
--- a/contrib/check_GNU_style_lib.py
+++ b/contrib/check_GNU_style_lib.py
@@ -78,10 +78,9 @@ class CheckError:
class LineLengthCheck:
def __init__(self):
self.limit = 80
- self.expanded_tab = ' ' * ts
def check(self, filename, lineno, line):
- line_expanded = line.replace('\t', self.expanded_tab)
+ line_expanded = line.expandtabs(ts)
if not filename.endswith(".opt") and len(line_expanded) > self.limit:
return CheckError(filename, lineno,
line_expanded[:self.limit]
--
2.43.0