This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC] Ignore source code comments in scripts/check-installed-headers.sh
- From: Tulio Magno Quites Machado Filho <tuliom at linux dot ibm dot com>
- To: DJ Delorie <dj at redhat dot com>, "Carlos O'Donell" <carlos at redhat dot com>, libc-alpha at sourceware dot org
- Date: Wed, 16 Jan 2019 21:05:45 -0200
- Subject: [RFC] Ignore source code comments in scripts/check-installed-headers.sh
- References: <xn1s5cjnyv.fsf@greed.delorie.com>
DJ Delorie <dj@redhat.com> 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 <tuliom@linux.ibm.com>
* scripts/check-installed-headers.sh: Pre-process header files
before checking for obsolete types.
Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
---
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
--
2.14.5