From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id jD5yDcdzIWbt+zMAWB0awg (envelope-from ) for ; Thu, 18 Apr 2024 15:25:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1713468359; bh=WJFgLv47/vsd/WWU+kEe7WCGx9cJ57GBenIfWlv1wOQ=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QgRKkvxg2yLjFyfywDIINdz+tXdj6zBS9eP8fNJdMyMikvt0hCVpQAcZGYR/GgKsR PZYUCX3bb5ms1qCNM5HuhOh66EAU8ruxvklSFahM6LJMzGbBlugOnZl/D3f7y6djb+ P9b6nvndCArJ2VAFMGfIsKPLkD1tEojMKZBEkRBg= Received: by simark.ca (Postfix, from userid 112) id 1C0711E0C0; Thu, 18 Apr 2024 15:25:59 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=DDgvP2pV; dkim-atps=neutral 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 (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id D4BE51E030 for ; Thu, 18 Apr 2024 15:25:56 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8872D386F444 for ; Thu, 18 Apr 2024 19:25:56 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 92381385840B for ; Thu, 18 Apr 2024 19:25:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 92381385840B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 92381385840B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713468339; cv=none; b=ukRFF7+WHQG0RABQC0v1UjGknxTAMx2gYnbsnCnEJy/AO8RlbRcdAkpLifkuMiWmB9VJXTOZILCAlj1MGbOLThOSbJtWMw/AiVXc+/KW6m49H8B08JpDELeSA0fkfOzRoiLjAQXl7Bx1xTWUEZd/fO3dtpaS4qaxwJ2PNuS++6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713468339; c=relaxed/simple; bh=WJFgLv47/vsd/WWU+kEe7WCGx9cJ57GBenIfWlv1wOQ=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=sRvuLAQi1L4vM5BwV9Dlzew/zNhVngLeRe3ggRDsjGK+qoEecjHHvG9eYr/u/I22VBgIY3nI1lucAO0Eme3FAhgP8esJU9y6EPwGK5unr0zERkGwDFRSPaThp3h90vPWIDa9dI9wznvKFBh2d65JHwHxIjYI4ruWSU3Kl/NQ8EY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1713468337; bh=WJFgLv47/vsd/WWU+kEe7WCGx9cJ57GBenIfWlv1wOQ=; h=Date:Subject:To:References:From:In-Reply-To:From; b=DDgvP2pV6De7oHHKrQAX6jSvMAlUzj01HcNkB0kw9304tQ070tm13bwi5FZcMHaWT nolTlxN2EO1cMSaFBh7M7gcx8ZAEnNcKtEpfdhOO0xhUrPXPzuCl0+MTMTtXFgWOk4 EfOlE3FfJPCD7RG60EJjk5m3kJvJm5jAINgMK9c0= Received: from [10.0.0.11] (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 226881E030; Thu, 18 Apr 2024 15:25:36 -0400 (EDT) Message-ID: <6b1239d1-c20a-45bc-8f5d-34b95e17f5c8@simark.ca> Date: Thu, 18 Apr 2024 15:25:36 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/4] Add an include-checking script To: Tom Tromey , gdb-patches@sourceware.org References: <20240418-header-check-v2-0-725529851603@adacore.com> <20240418-header-check-v2-2-725529851603@adacore.com> Content-Language: en-US From: Simon Marchi In-Reply-To: <20240418-header-check-v2-2-725529851603@adacore.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org On 2024-04-18 11:41, Tom Tromey wrote: > This adds a new Python script that checks the header guards of all gdb > source files. It enforces a fairly strict formatting and naming > scheme. > > In particular, for a file "x/y-z.h" (relative to the repository root), > the include guard will be named "X_Y_Z_H". Only the '#ifndef' form is > allowed, not "#if !defined(...)". The trailing comment on the > "#endif" is also required. > > The script also tries to update files that appear to have the required > lines if they are in the wrong form or use the wrong name. > --- > gdb/check-include-guards.py | 125 ++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 125 insertions(+) > > diff --git a/gdb/check-include-guards.py b/gdb/check-include-guards.py > new file mode 100755 > index 00000000000..5c61fc90bb0 > --- /dev/null > +++ b/gdb/check-include-guards.py > @@ -0,0 +1,125 @@ > +#!/usr/bin/env python3 > + > +# Copyright (C) 2024 Free Software Foundation, Inc. > +# > +# This file is part of GDB. > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see . > + > +# This is intended to be run from pre-commit. You can also run it by > +# hand by passing repository-relative filenames to it, like: > +# ./gdb/check-include-guards.py gdb/*.h > + > + > +import glob > +import re > +import sys > + > +status = 0 > + > +DEF = re.compile("^#ifndef ([A-Za-z0-9_]+)\n") > +OLDDEF = re.compile("^#if !defined *\\(([A-Za-z0-9_]+)\\)\n") > + > + > +def failure(filename, ndx, text): > + print(filename + ":" + str(ndx + 1) + ": " + text) > + global status > + status = 1 > + > + > +def headers(dirname): > + return glob.iglob(dirname + "/*.h") This appears to be the same code as in v1, did you forget to commit your changes or something like that? You replied that you removed this unused function, but here it is. Simon