From a3c6e99c9cde0f786fa3df88360c84cf33ddc278 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Sat, 31 Oct 2015 15:49:01 +0100 Subject: [PATCH] syntax-check: fix sed syntax errors Multi-line single-quoted shell arguments defined within makefile rules end up having the trailing backslash. This caused problem in some sc_* rules as GNU sed does not interpret trailing backslash the same way as SHELL (== appending next line). Switching to double quotes means that SHELL will remove the trailing backslash for subsequent sed call. This silences a lot of GNU sed warnings seen before like: sed: -e expression #1, char 96: unterminated address regex * cfg.mk (sc_libtool_m4_cc_basename): Use $(SED) instead of sed, use double quotes for sed's multi-line argument. (sc_prohibit_set_dummy_without_shift): Likewise. (sc_prohibit_test_const_follows_var): Likewise. --- cfg.mk | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cfg.mk b/cfg.mk index c04248f1..42eea189 100644 --- a/cfg.mk +++ b/cfg.mk @@ -70,9 +70,9 @@ local-checks-to-skip = \ # Check for correct usage of $cc_basename in libtool.m4. sc_libtool_m4_cc_basename: - @sed -n '/case \$$cc_basename in/,/esac/ { \ + @$(SED) -n "/case \\\$$cc_basename in/,/esac/ { \ /^[ ]*[a-zA-Z][a-zA-Z0-9+]*[^*][ ]*)/p; \ - }' '$(srcdir)/$(macro_dir)/libtool.m4' | grep . && { \ + }" '$(srcdir)/$(macro_dir)/libtool.m4' | grep . && { \ msg="\$$cc_basename matches should include a trailing '*'." \ $(_sc_say_and_exit) } || : @@ -142,12 +142,12 @@ sc_prohibit_set_dummy_without_shift: @files=$$($(VC_LIST_EXCEPT)); \ if test -n "$$files"; then \ grep -nE '(set dummy|shift)' $$files | \ - sed -n '/set[ ][ ]*dummy/{ \ + $(SED) -n "/set[ ][ ]*dummy/{ \ /set.*dummy.*;.*shift/d; \ N; \ /\n.*shift/D; \ p; \ - }' | grep -n . && { \ + }" | grep -n . && { \ msg="use 'shift' after 'set dummy'" \ $(_sc_say_and_exit) } || :; \ else :; \ @@ -216,11 +216,11 @@ sc_prohibit_test_const_follows_var: exclude_file_name_regexp--sc_require_function_nl_brace = (^HACKING|\.[ch]|\.texi)$$ sc_require_function_nl_brace: @for file in $$($(VC_LIST_EXCEPT)); do \ - sed -n '/^func_[^ ]*[ ]*(/{ \ + $(SED) -n "/^func_[^ ]*[ ]*(/{ \ N; \ /^func_[^ ]* ()\n{$$/d; \ p; \ - }' $$file | grep -E . && { \ + }" $$file | grep -E . && { \ msg="found malformed function_definition in $$file" \ $(_sc_say_and_exit) } || :; \ done