]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
syntax-check: fix violations and implement sc_prohibit_bare_basename.
authorGary V. Vaughan <gary@gnu.org>
Sat, 19 Nov 2011 15:53:20 +0000 (22:53 +0700)
committerGary V. Vaughan <gary@gnu.org>
Fri, 25 Nov 2011 07:53:41 +0000 (14:53 +0700)
* cfg.mk (sc_prohibit_bare_basename, sc_prohibit_basename_with_sed):
Make sure not to go back to using occasional `|$basename' or
`|$dirname' syntax.
* build-aux/git-hooks/commit-msg, build-aux/ltmain.m4sh,
* build-aux/options-parser, tests/fcdemo-conf.test,
* tests/fcdemo-shared.test, tests/fcdemo-static.test,
* tests/libtoolize.at: Fix violations.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
build-aux/git-hooks/commit-msg
build-aux/ltmain.m4sh
build-aux/options-parser
cfg.mk
tests/fcdemo-conf.test
tests/fcdemo-shared.test
tests/fcdemo-static.test
tests/libtoolize.at

index f2e610800ff2277a76e8ec15ad801d93c494496b..ba1073bc0d7f2cbb0b5ca089da9d542ee44dc4ae 100755 (executable)
@@ -6,13 +6,13 @@
 : ${SED="sed"}
 test set = ${ECHO+'set'} = set || ECHO='printf %s\n'
 
-basename="$SED -e "'s|^.*/||'
+basename='s|^.*/||'
 
 nl='
 '
 
 progpath=$0
-progname=`$ECHO "$progpath" |$basename`
+progname=`$ECHO "$progpath" |$SED -e "$basename"`
 
 log_file=$1
 export log_file
index 02ff034d7855c536e3d6c1e671f8b5ede5deee41..b60b574a6ffaf04bc13beca28c353c915963b78f 100644 (file)
@@ -3027,7 +3027,8 @@ func_extract_archives ()
          cd $my_xdir || exit $?
          darwin_archive=$my_xabs
          darwin_curdir=`pwd`
-         darwin_base_archive=`basename "$darwin_archive"`
+         func_basename "$darwin_archive"
+         darwin_base_archive=$func_basename_result
          darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
          if test -n "$darwin_arches"; then
            darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
index 4777d7670c0d40e8792226dea1a9f78e0758b9aa..566ae4301f69b393e0207be79a13d940255eb4af 100644 (file)
@@ -167,8 +167,8 @@ EXIT_SKIP=77      # $? = 77 is used to indicate a skipped test to automake.
 debug_cmd=${debug_cmd-":"}
 exit_cmd=:
 
-dirname="$SED -e "'s|/[^/]*$||'
-basename="$SED -e "'s|^.*/||'
+dirname='s|/[^/]*$||'
+basename='s|^.*/||'
 
 nl='
 '
@@ -181,7 +181,7 @@ nl='
 progpath=$0
 
 # The name of this program.
-progname=`echo "$progpath" |$basename`
+progname=`echo "$progpath" |$SED "$basename"`
 
 
 ## ------------------------- ##
diff --git a/cfg.mk b/cfg.mk
index c9bfd9273111dac1d8cd6d39341f11af5a35b5db..3c366bde22600769f5511261488b907ee0a2efed 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -75,6 +75,17 @@ sc_prohibit_Xsed_without_X:
        else :;                                                         \
        fi || :
 
+# Use a consistent dirname and basename idiom.
+sc_prohibit_bare_basename:
+       @prohibit='\|[   ]*\$$(base|dir)name' \
+       halt='use `|$$SED "$$basename"'\'' instead of `|$$basename'\'   \
+         $(_sc_search_regexp)
+
+sc_prohibit_basename_with_dollar_sed:
+       @prohibit='(base|dir)name="?(\$$SED|sed)[ "]' \
+       halt='use `basename='\''s|^.*/||'\'' instead of `basename="$$SED...'    \
+         $(_sc_search_regexp)
+
 # Check for using `[' instead of `test'.
 exclude_file_name_regexp--sc_prohibit_bracket_as_test = ^cfg.mk$$
 sc_prohibit_bracket_as_test:
index b7e08a641d103e4f3f1137e6b2251ee5ba42cc91..028b53ea51df6767b848aab79a828a8d27dca09f 100755 (executable)
@@ -31,7 +31,7 @@ func_make_distclean
 # We do not want to fail if all we got was a Fortran 77 compiler.
 func_configure_nofail
 if test "$conf_status" -eq "$EXIT_FAILURE"; then
-  case `echo $FC | $SED $basename` in
+  case `echo $FC | $SED "$basename"` in
     g77* | f77* | xlf | xlf[_-]* | frt* | pgf77* | cf77* | fort77* | fl32* | af77*)
        func_skip "The FC fortran tests do not work with Fortran 77 compilers" ;;
     *) exit $EXIT_FAILURE
index f20cb5d509c8573ed04fabe6cdb56b732b5f5d6f..76fb6947189daf3d850f7c7acf2d6140077af7bd 100755 (executable)
@@ -31,7 +31,7 @@ func_make_distclean
 # We do not want to fail if all we got was a Fortran 77 compiler.
 func_configure_nofail "--disable-static"
 if test "$conf_status" -eq "$EXIT_FAILURE"; then
-  case `echo $FC | $SED $basename` in
+  case `echo $FC | $SED "$basename"` in
     g77* | f77* | xlf | xlf[_-]* | frt* | pgf77* | cf77* | fort77* | fl32* | af77*)
        func_skip "The FC fortran tests do not work with Fortran 77 compilers" ;;
     *) exit $EXIT_FAILURE
index 0f8dede7eb31d6180c418bfaf5d9cb0f44c4c1d5..2e27020abacfeb29f4b328f7d51df6483246e1a6 100755 (executable)
@@ -31,7 +31,7 @@ func_make_distclean
 # We do not want to fail if all we got was a Fortran 77 compiler.
 func_configure_nofail "--disable-shared"
 if test "$conf_status" -eq "$EXIT_FAILURE"; then
-  case `echo $FC | $SED $basename` in
+  case `echo $FC | $SED "$basename"` in
     g77* | f77* | xlf | xlf[_-]* | frt* | pgf77* | cf77* | fort77* | fl32* | af77*)
        func_skip "The FC fortran tests do not work with Fortran 77 compilers" ;;
     *) exit $EXIT_FAILURE
index e112acf4308c5b2944313a0cf49c21a822cc9313..9c97fdb4ca9606a6258da2bcba406a459402a678 100644 (file)
@@ -696,7 +696,7 @@ LT_AT_ACLOCAL([-I $abs_top_srcdir/m4])
 : ${GREP="grep"}
 : ${SED="sed"}
 
-basename="$SED -e s,^.*/,,"
+basename='s,^.*/,,'
 
 # func_grep expression filename
 # Check whether EXPRESSION matches any line of FILENAME, without output.
@@ -724,7 +724,7 @@ func_serial ()
     my_serial=
     if test -z "$my_macro_regex" ||
        test "$my_filename" = aclocal.m4 ||
-       test "$my_macro_regex" = `echo "$my_filename" | $basename` ||
+       test "$my_macro_regex" = `echo "$my_filename" | $SED "$basename"` ||
        func_grep '^AC_DEFUN(\@<:@'"$my_macro_regex" "$my_filename"
     then
       my_serial=`$SED -e "$my_sed_serial" "$my_filename"`