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: 31081 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