From patchwork Wed Jan 16 23:05:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tulio Magno Quites Machado Filho X-Patchwork-Id: 1026261 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-99350-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="rLo9q/xx"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43g2s029rZz9sBQ for ; Thu, 17 Jan 2019 10:06:44 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:in-reply-to:references :message-id; q=dns; s=default; b=kj0TjXWpkqnE3ed6eae1Vx0Rdrv3xCO UWd99R8daJAZGgd3V7DvX4Iwk7CAG90hFBN9DEE5xy7iT270X3qOFcnzCeUEYU7U osDEqrKhiW79Ep9Zng33lPL/qzDb1R2cUzNOhXHRDyAKdlsbflDg9j8JqgiyzUOt JT0a+hxdD4KI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:in-reply-to:references :message-id; s=default; bh=7EsEvtYXklLiv+piEND4Lhm4Ddg=; b=rLo9q /xxczmQBR3uNH/BhT9OCbgN8DoLsJXH7wurHbnCr67xtjrG58OOPNIpxZQ1RUoER Oc4scZxfcOzpp06HI1ERm+eyb0FJ71wshtPdAMZH/dHpfYtcXpLO5bXspDsOEzaN 7ljqdmjIXL1s80ZWhF0YOF0p+JG3jW3XIc0nAM= Received: (qmail 46896 invoked by alias); 16 Jan 2019 23:06:38 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 46886 invoked by uid 89); 16 Jan 2019 23:06:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-27.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1563 X-HELO: mx0a-001b2d01.pphosted.com From: Tulio Magno Quites Machado Filho To: DJ Delorie , "Carlos O'Donell" , libc-alpha@sourceware.org Subject: [RFC] Ignore source code comments in scripts/check-installed-headers.sh Date: Wed, 16 Jan 2019 21:05:45 -0200 In-Reply-To: References: x-cbid: 19011623-0068-0000-0000-00000383D9AE X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010420; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000274; SDB=6.01147499; UDB=6.00597741; IPR=6.00927794; MB=3.00025163; MTD=3.00000008; XFM=3.00000015; UTC=2019-01-16 23:06:32 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19011623-0069-0000-0000-00004728C806 Message-Id: <20190116230545.8745-1-tuliom@linux.ibm.com> DJ Delorie writes: > I think ignoring comments is the right way to go, else we can't allow a > comment like: > > /* Don't use ulong here, it's obsolete. */ > > I don't ever think it's a good idea for commentary to limit technical > choice. > > I won't comment on how hard expanding a regex might be ;-) Or we could reuse the preprocessor to do that for us... ;-) Carlos, could you test if this works in the case you found, please? ---8<--- Use the preprocessor to remove source code comments from header files before testing if they have any obsolete type. 2019-01-16 Tulio Magno Quites Machado Filho * scripts/check-installed-headers.sh: Pre-process header files before checking for obsolete types. Signed-off-by: Tulio Magno Quites Machado Filho --- scripts/check-installed-headers.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh index 8e7beffd82..291774c696 100644 --- a/scripts/check-installed-headers.sh +++ b/scripts/check-installed-headers.sh @@ -158,7 +158,9 @@ EOF # Don't repeat work. eval 'case "$h" in ('"$already"') continue;; esac' - if grep -qE "$obsolete_type_re" "$h"; then + # Use the preprocessor to remove comments in the source. + if $cc_cmd -E -fpreprocessed "$h" -o - \ + | grep -qE "$obsolete_type_re"; then echo "*** Obsolete types detected:" grep -HE "$obsolete_type_re" "$h" failed=1