From: Torbjörn SVENSSON Date: Tue, 28 Jul 2026 20:15:28 +0000 (+0200) Subject: contrib: add support for tabs in the middle of the line X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5dfea15a44343841a5d3d18ee736eaeb4f48fb1d;p=thirdparty%2Fgcc.git contrib: add support for tabs in the middle of the line 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. */ 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. Signed-off-by: Torbjörn SVENSSON --- 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]