From patchwork Fri May 31 19:38:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Dapp X-Patchwork-Id: 1942293 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=i3QOvt5g; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VrYNF0yZ0z20Pc for ; Sat, 1 Jun 2024 05:39:23 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 288CE38708BF for ; Fri, 31 May 2024 19:39:21 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by sourceware.org (Postfix) with ESMTPS id 5AE06385E836 for ; Fri, 31 May 2024 19:39:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5AE06385E836 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5AE06385E836 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717184344; cv=none; b=HbrTZBKbMWFRtZ00YJH7J2f+On5/CRw0mxxUZrCXtmI8dTOJ1tHTZcuPXOMlmPR13i4+nzWeL2lcUJlrpJo5FjfpxRQouC5dDPqO8VyYgEh4SoReP70fS+uAWolQKTo5aOap9EjxURraEMawSP1jRz8+Kslu9OE0MVG+UNfQ32o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717184344; c=relaxed/simple; bh=2X45rqtCOUM7MjAiIw/uvHksj3ylrhysqIbxNwtw1JA=; h=DKIM-Signature:Message-ID:Date:MIME-Version:From:Subject:To; b=NaIptQ5gqtG2dq1+Q2/MAIDA6z0mVjoO6gcfJF5V7KxbW/K9oM18gRw8+RDb1Ol3A5Oug4F0/26AYWDudxwbZ7aM3KpkoYeABKn6+tHNJ9lkRQRgSPI2gog8dencC63ShLs/8jflOmWOhYqq/F1xE5/AdzIUwvZ5jgFkVKXqBdg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2e6f2534e41so17106151fa.0 for ; Fri, 31 May 2024 12:39:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717184340; x=1717789140; darn=gcc.gnu.org; h=content-transfer-encoding:to:subject:from:content-language:cc :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=T+1Vxkl8Y2J5+DYvd8xp9RqKuDdEU4bjK/JoYYv06hI=; b=i3QOvt5gzLa+UYj4jVT5zAYpmxeQsjY4DuWryr0lmhaIc7PFctX4ptblOtB6Ps8KHz x1MAitcuLU6SMyRcEQ1W18Uh3iSSSymXEeWI3KeOTnkaRsHzBdpcRTxKiGD0TJ/ZoRWo 9eo2HjoYHnxf3dO+q5OVykqC449RmvrpTmTA4hT6SyHppToTfDLpT1g5fUCHDzlPvpmS d06M1xRAfti3T0joekcMYWi9dafEQwuUPMo9dQVbwX/bv8D/NFeHSkfhqxFgzCLhQWut 8isStGzdTmwDJUJtKf8h1/kQOWlbGjPRQekiGOtY0WtLkO+kYRFiM0Rw2z3USjevntDm 0XNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717184340; x=1717789140; h=content-transfer-encoding:to:subject:from:content-language:cc :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=T+1Vxkl8Y2J5+DYvd8xp9RqKuDdEU4bjK/JoYYv06hI=; b=o8IuusMu3d38hD3JfVa7QHBl4grNBF5D84cLvN3syftNhJGDBreR3+yfJ5V98eqRbj 9zxJbHJkVtL8I8r3zALQAcJ4HqS+ZVg3JWVTbH5ygJw/LMWriomHz5nROB3MN+Dqpnpl eVgz2/2gox0q4Mequ4s9kXS4dCQF5LDF8DKqWYVfTPLaXdMyXEW7Zv8sASRic767+a4/ ZqqSLN4l8M639/0632N0RxgcBt6PPjFWMJi1Ejrc40ugmFT7GrCvypP6uLrvEi0boHXE GMQHULIw6FnjYPQhXPDHSmSJxsShuZt9QvyIQMNmEJ9fo/GOSIvGWLBeWVzSmDeBvwwC DwQQ== X-Gm-Message-State: AOJu0Yyi3xLmsP0lGLPoUyJ4gWhJZ3+GRwrBg8ZdpvOJwdUsC8KZh5Dj SMOeWoNIgt5ySnupm4pKaYXITnhatiTjUI0PHMZuXvjNvbp1Z6R1sowxHA== X-Google-Smtp-Source: AGHT+IHRTWY7km1xnaRib17z+CXCxqPIQmg0EYQtYmztO1ZALZM0s2wdsHC4yRsYT3upGWIqHRWRxQ== X-Received: by 2002:a2e:b615:0:b0:2d4:3e82:117e with SMTP id 38308e7fff4ca-2ea951acc2amr17838201fa.32.1717184339886; Fri, 31 May 2024 12:38:59 -0700 (PDT) Received: from [192.168.1.31] (ip-149-172-150-237.um42.pools.vodafone-ip.de. [149.172.150.237]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57a31bb81ecsm1324765a12.28.2024.05.31.12.38.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 31 May 2024 12:38:59 -0700 (PDT) Message-ID: <651a7701-8897-49e1-a1c6-72d6cf99ec74@gmail.com> Date: Fri, 31 May 2024 21:38:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: rdapp.gcc@gmail.com Content-Language: en-US From: Robin Dapp Subject: [PATCH] check_GNU_style: Use raw strings. To: gcc-patches X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi, this silences some warnings when using check_GNU_style. I didn't expect this to have any bootstrap or regtest impact but I still ran it on x86 - no change. Regards Robin contrib/ChangeLog: * check_GNU_style_lib.py: Use raw strings for regexps. --- contrib/check_GNU_style_lib.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/contrib/check_GNU_style_lib.py b/contrib/check_GNU_style_lib.py index f1a120fa8d3..6dbe4b53559 100755 --- a/contrib/check_GNU_style_lib.py +++ b/contrib/check_GNU_style_lib.py @@ -103,7 +103,7 @@ class SpacesCheck: class SpacesAndTabsMixedCheck: def __init__(self): - self.re = re.compile('\ \t') + self.re = re.compile(r'\ \t') def check(self, filename, lineno, line): stripped = line.lstrip() @@ -115,7 +115,7 @@ class SpacesAndTabsMixedCheck: class TrailingWhitespaceCheck: def __init__(self): - self.re = re.compile('(\s+)$') + self.re = re.compile(r'(\s+)$') def check(self, filename, lineno, line): assert(len(line) == 0 or line[-1] != '\n') @@ -128,7 +128,7 @@ class TrailingWhitespaceCheck: class SentenceSeparatorCheck: def __init__(self): - self.re = re.compile('\w\.(\s|\s{3,})\w') + self.re = re.compile(r'\w\.(\s|\s{3,})\w') def check(self, filename, lineno, line): m = self.re.search(line) @@ -140,7 +140,7 @@ class SentenceSeparatorCheck: class SentenceEndOfCommentCheck: def __init__(self): - self.re = re.compile('\w\.(\s{0,1}|\s{3,})\*/') + self.re = re.compile(r'\w\.(\s{0,1}|\s{3,})\*/') def check(self, filename, lineno, line): m = self.re.search(line) @@ -152,7 +152,7 @@ class SentenceEndOfCommentCheck: class SentenceDotEndCheck: def __init__(self): - self.re = re.compile('\w(\s*\*/)') + self.re = re.compile(r'\w(\s*\*/)') def check(self, filename, lineno, line): m = self.re.search(line) @@ -164,7 +164,7 @@ class SentenceDotEndCheck: class FunctionParenthesisCheck: # TODO: filter out GTY stuff def __init__(self): - self.re = re.compile('\w(\s{2,})?(\()') + self.re = re.compile(r'\w(\s{2,})?(\()') def check(self, filename, lineno, line): if '#define' in line: @@ -179,7 +179,7 @@ class FunctionParenthesisCheck: class SquareBracketCheck: def __init__(self): - self.re = re.compile('\w\s+(\[)') + self.re = re.compile(r'\w\s+(\[)') def check(self, filename, lineno, line): if filename.endswith('.md'): @@ -194,7 +194,7 @@ class SquareBracketCheck: class ClosingParenthesisCheck: def __init__(self): - self.re = re.compile('\S\s+(\))') + self.re = re.compile(r'\S\s+(\))') def check(self, filename, lineno, line): m = self.re.search(line) @@ -208,7 +208,7 @@ class BracesOnSeparateLineCheck: # This will give false positives for C99 compound literals. def __init__(self): - self.re = re.compile('(\)|else)\s*({)') + self.re = re.compile(r'(\)|else)\s*({)') def check(self, filename, lineno, line): m = self.re.search(line) @@ -219,7 +219,7 @@ class BracesOnSeparateLineCheck: class TrailinigOperatorCheck: def __init__(self): - regex = '^\s.*(([^a-zA-Z_]\*)|([-%<=&|^?])|([^*]/)|([^:][+]))$' + regex = r'^\s.*(([^a-zA-Z_]\*)|([-%<=&|^?])|([^*]/)|([^:][+]))$' self.re = re.compile(regex) def check(self, filename, lineno, line):