summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-03-15 17:53:00 +0100
committerJim Meyering <meyering@redhat.com>2008-03-16 19:04:29 +0100
commit0ecdb0a52a80d0fd5d2c448b6cab8276e9934c81 (patch)
treecd37cbedda0fd5d594d7889d9c1b999c26e17c17
parent12ff1eb9b91f795b9f3b930234e1702d9dfc3943 (diff)
downloadcoreutils-0ecdb0a52a80d0fd5d2c448b6cab8276e9934c81.tar.xz
Prohibit inclusion of getopt.h without use.
* Makefile.maint (sc_prohibit_getopt_without_use): New rule.
-rw-r--r--Makefile.maint12
1 files changed, 12 insertions, 0 deletions
diff --git a/Makefile.maint b/Makefile.maint
index de49669b8..7a0157ba7 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -178,6 +178,18 @@ sc_prohibit_assert_without_use:
else :; \
fi
+# Prohibit the inclusion of getopt.h without an actual use.
+sc_prohibit_getopt_without_use:
+ @if $(CVS_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
+ files=$$(grep -l '# *include <getopt\.h>' \
+ $$($(CVS_LIST_EXCEPT) | grep '\.c$$')) && \
+ grep -E -L '\<getopt(_long)? \(' $$files \
+ | grep . && \
+ { echo "$(ME): the above files include <assert.h> but don't use it" \
+ 1>&2; exit 1; } || :; \
+ else :; \
+ fi
+
# Don't include quotearg.h unless you use one of its functions.
sc_prohibit_quotearg_without_use:
@if $(CVS_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \