From: Pádraig Brady
Date: Thu, 23 Oct 2014 09:51:22 +0000 (+0100) Subject: maint: improve sc_long_lines syntax-check speed X-Git-Tag: v8.24~192 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=414a8cf52ff2315e60a86007ffafd1513e5f55c7;p=thirdparty%2Fcoreutils.git maint: improve sc_long_lines syntax-check speed sc_long_lines was the slowest syntax check before$ time make sc_long_lines long_lines real 0m2.740s after $ time make sc_long_lines long_lines real 0m0.677s * src/cfg.mk (sc_dd_max_sym_length): s/--max-line-length/-L/ for compat with BSDs. (sc_long_lines): Prefilter with wc -L to only identify lines in files that have lines longer than 80 characters. --- diff --git a/cfg.mk b/cfg.mk index d95bfacb41..4bc3792191 100644 --- a/cfg.mk +++ b/cfg.mk @@ -74,10 +74,9 @@ sc_dd_max_sym_length: ifneq ($(wildcard $(dd_c)),) @len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\ sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \ - |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \ - | wc --max-line-length); \ + |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p'| wc -L);\ max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \ - |tr -d '"' | wc --max-line-length); \ + |tr -d '"' | wc -L); \ if test "$$len" = "$$max"; then :; else \ echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \ exit 1; \ @@ -239,17 +238,17 @@ sc_prohibit-gl-attributes: # - the help2man script copied from upstream, # - tests involving long checksum lines, and # - the 'pr' test cases. -LINE_LEN_MAX = 80 FILTER_LONG_LINES = \ /^[^:]*\.diff:[^:]*:@@ / d; \ \|^[^:]*man/help2man:| d; \ \|^[^:]*tests/misc/sha[0-9]*sum.*\.pl[-:]| d; \ \|^[^:]*tests/pr/|{ \|^[^:]*tests/pr/pr-tests:| !d; }; sc_long_lines: - @files=$$($(VC_LIST_EXCEPT)) \ - halt='line(s) with more than $(LINE_LEN_MAX) characters; reindent'; \ + @files=$$($(VC_LIST_EXCEPT) | xargs wc -L | sed -rn '/ total$$/d;\ + s/^ *(8[1-9]|9[0-9]|[0-9]\{3,\}) //p'); \ + halt='line(s) with more than 80 characters; reindent'; \ for file in $$files; do \ - expand $$file | grep -nE '^.{$(LINE_LEN_MAX)}.' | \ + expand $$file | grep -nE '^.{80}.' | \ sed -e "s|^|$$file:|" -e '$(FILTER_LONG_LINES)'; \ done | grep . && { msg="$$halt" $(_sc_say_and_exit) } || :