[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: I: typo in coreutils-v6.10-117-g0ecdb0a
From: |
Jim Meyering |
Subject: |
Re: I: typo in coreutils-v6.10-117-g0ecdb0a |
Date: |
Tue, 18 Mar 2008 21:38:27 +0100 |
"Dmitry V. Levin" <address@hidden> wrote:
> Looks like there is a typo in commit v6.10-117-g0ecdb0a,
> it needs s/assert.h/getopt.h/
As penance for my copy-paste error, I've factored out all of
the duplication in those sc_prohibit_*_without_use rules:
Factor out duplication in sc_prohibit_*_without_use rules.
* Makefile.maint (_header_without_use): New "command",
factored out of four sc_prohibit_HEADER_without_use rules.
(sc_prohibit_assert_without_use): Rewrite using $(_header_without_use).
(sc_prohibit_getopt_without_use): Likewise.
(sc_prohibit_quotearg_without_use): Likewise.
(sc_prohibit_quote_without_use): Likewise.
---
Makefile.maint | 55 +++++++++++++++++++------------------------------------
1 files changed, 19 insertions(+), 36 deletions(-)
diff --git a/Makefile.maint b/Makefile.maint
index 23a64ee..a79b278 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -166,53 +166,36 @@ sc_require_config_h:
else :; \
fi
+# To use this "command" macro, you must first define two shell variables:
+# h: the header, enclosed in <> or ""
+# re: a regular expression that matches IFF something provided by $h is used.
+define _header_without_use
+ h_esc=`echo "$$h"|sed 's/\./\\./'`; \
+ if $(CVS_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
+ files=$$(grep -l '^# *include '"$$h_esc" \
+ $$($(CVS_LIST_EXCEPT) | grep '\.c$$')) && \
+ grep -LE "$$re" $$files | grep . &&
\
+ { echo "$(ME): the above files include $$h but don't use it" \
+ 1>&2; exit 1; } || :; \
+ else :; \
+ fi
+endef
+
# Prohibit the inclusion of assert.h without an actual use of assert.
sc_prohibit_assert_without_use:
- @if $(CVS_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
- files=$$(grep -l '# *include <assert\.h>' \
- $$($(CVS_LIST_EXCEPT) | grep '\.c$$')) && \
- grep -L '\<assert (' $$files \
- | grep . && \
- { echo "$(ME): the above files include <assert.h> but don't use it"
\
- 1>&2; exit 1; } || :; \
- else :; \
- fi
+ @h='<assert.h>' re='\<assert \(' $(_header_without_use)
# 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 <getopt.h> but don't use it"
\
- 1>&2; exit 1; } || :; \
- else :; \
- fi
+ @h='<getopt.h>' re='\<getopt(_long)? \(' $(_header_without_use)
# 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 \
- files=$$(grep -l '# *include "quotearg\.h"' \
- $$($(CVS_LIST_EXCEPT) | grep '\.c$$')) && \
- grep -LE '\<quotearg(_[^ ]+)? \(' $$files \
- | grep . && \
- { echo "$(ME): the above files include "quotearg.h" but don't use
it" \
- 1>&2; exit 1; } || :; \
- else :; \
- fi
+ @h='"quotearg.h"' re='\<quotearg(_[^ ]+)? \(' $(_header_without_use)
# Don't include quote.h unless you use one of its functions.
sc_prohibit_quote_without_use:
- @if $(CVS_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
- files=$$(grep -l '# *include "quote\.h"' \
- $$($(CVS_LIST_EXCEPT) | grep '\.c$$')) && \
- grep -LE '\<quote(_n)? \(' $$files \
- | grep . && \
- { echo "$(ME): the above files include "quote.h" but don't use it" \
- 1>&2; exit 1; } || :; \
- else :; \
- fi
+ @h='"quote.h"' re='\<quote(_n)? \(' $(_header_without_use)
sc_obsolete_symbols:
@grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
--
1.5.5.rc0.7.g57e83