Hi Paul,

* Paul Eggert wrote on Wed, Apr 05, 2006 at 02:37:28AM CEST:
> Ralf Wildenhues <[EMAIL PROTECTED]> writes:
> 
> > -   @grep -nE '\<free \(\(' $(srcdir)/{lib,src}/*.[chly] &&         \
> > +   @grep -nE '\<free \(\('                                         \
> > +       $(srcdir)/{lib,src}/*.[chly] /dev/null 2>/dev/null &&       \
> 
> How about if we use 'shopt -s nullglob' instead?  That way, we don't
> have to have the '2>/dev/null', and we catch a problem if a file is
> unreadable (e.g., dangling symlink).  shopt isn't portable, but surely
> we can assume Bash here.

Good idea.

> We can do this systematically, even for files that don't glob now.

Yes, done.

> >  sc_changelog:
> > -   @grep -n '^[^12 ]' $$(find . -maxdepth 2 -name ChangeLog) &&    \
> > +   @sed '/^-----/,$$d' $$(find . -maxdepth 2 -name ChangeLog)      \
> 
> Shouldn't there be a /dev/null here too, in case there are no ChangeLog
> files at all?

As far as I know, ChangeLog files are mandatory.  According to
standards.texi, you can share one ChangeLog for a tree of
subdirectories, but it has to sit in the top directory.  So I
think it's not bad to enforce that.

I found more issues with imported files (standards.texi has trailing
spaces, for example; sorry for not catching this earlier), and I think
that it's not our job to keep those files clean, esp. as that could be
daunting.  Same thing with generated files: Automake's macros may
contain space-tab; also, expansion of innocent Autoconf macros may lead
to space-tab.

So let's add some exemptions.

I have already applied the second patch (which was reviewed already).
Unless there are objections to the first (adding the .x-* files and so
on), I will apply that tomorrow as well.  With the patch in place,
syntax-check passes.

Cheers,
Ralf

        * doc/autoconf.texi: Remove unused words from word list.
        * .x-sc_prohibit_atoi_atof, .x-sc_space_tab, .x-sc_sun_os_names,
        .x-sc_trailing_space: New files.

        * Makefile.maint (sc_cast_of_argument_to_free): Do not fail when
        no file matches the glob, discard the warning, set `nullglob'.
        (syntax-check): Likewise.
        (sc_cast_of_x_alloc_return_value): Likewise.
        (sc_cast_of_alloca_return_value, sc_error_exit_success)
        (sc_prohibit_jm_in_m4, .re-list, sc_unmarked_diagnostics)
        (m4-check): Likewise.
        (sc_system_h_headers): Do not print rule on execution.
        (sc_tight_scope): Do not fail for non-existing `src' directory.
        (sc_changelog): Skip the Copyright footer.
        * lib/autoconf/lang.m4: Remove trailing space.
        * doc/autoconf.texi: Remove unused words from word list.
        * .x-sc_prohibit_atoi_atof, .x-sc_space_tab, .x-sc_sun_os_names,
        .x-sc_trailing_space: New files.

--- /dev/null   2006-01-01 00:00:01.000000000 +0000
+++ .x-sc_prohibit_atoi_atof    2006-04-06 16:16:32.000000000 +0200
@@ -0,0 +1,3 @@
+ChangeLog
+Makefile.maint
+doc/autoconf.texi
--- /dev/null   2006-01-01 00:00:01.000000000 +0000
+++ .x-sc_space_tab     2006-04-06 16:03:57.000000000 +0200
@@ -0,0 +1,4 @@
+config/config.guess
+config/config.sub
+aclocal.m4
+configure
--- /dev/null   2006-01-01 00:00:01.000000000 +0000
+++ .x-sc_sun_os_names  2006-04-06 16:05:19.000000000 +0200
@@ -0,0 +1 @@
+config/config.guess
--- /dev/null   2006-01-01 00:00:01.000000000 +0000
+++ .x-sc_trailing_space        2006-04-06 16:09:28.000000000 +0200
@@ -0,0 +1,2 @@
+config/texinfo.tex
+doc/standards.texi
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.984
diff -u -r1.984 autoconf.texi
--- doc/autoconf.texi   5 Apr 2006 22:41:36 -0000       1.984
+++ doc/autoconf.texi   6 Apr 2006 16:16:59 -0000
@@ -17746,7 +17746,7 @@
 @c  LocalWords:  Systemology Checkpointing Changequote INTERCAL changequote dfn
 @c  LocalWords:  Quadrigraphs builtins Shellology acconfig Bugward LIBOBJ Imake
 @c  LocalWords:  LIBOBJS IFELSE cindex flushright Pinard Metaconfig uref Simons
[EMAIL PROTECTED]  LocalWords:  filesystems distclean uninstall noindent 
versioning Tromey dir
[EMAIL PROTECTED]  LocalWords:  distclean uninstall noindent versioning Tromey 
dir
 @c  LocalWords:  SAMS samp aclocal acsite underquoted emph itemx prepend SUBST
 @c  LocalWords:  evindex automake Gettext autopoint gettext symlink libtoolize
 @c  LocalWords:  defmac INIT tarname ovindex cvindex BUGREPORT PREREQ asis PROG
@@ -17802,7 +17802,7 @@
 @c  LocalWords:  drivespec Posixy DJGPP doschk prettybird LPT pfew Zsh's yu yaa
 @c  LocalWords:  yM uM aM firebird IP subdir misparses ok Unpatched abc bc zA
 @c  LocalWords:  CDPATH DUALCASE LINENO prepass Subshells lineno NULLCMD cmp wc
[EMAIL PROTECTED]  LocalWords:  MAILPATH scanset arg NetBSD Almquist printf 
filesystem expr cp
[EMAIL PROTECTED]  LocalWords:  MAILPATH scanset arg NetBSD Almquist printf 
expr cp
 @c  LocalWords:  Oliva awk Aaaaarg cmd regex xfoo GNV OpenVMS unwriteable te VM
 @c  LocalWords:  coreutils sparc Proulx SysV nbar nfoo maxdepth acdilrtu TWG mc
 @c  LocalWords:  mkdir exe uname OpenBSD Fileutils mktemp umask TMPDIR guid os
        * Makefile.maint (sc_cast_of_argument_to_free): Do not fail when
        no file matches the glob, discard the warning, set `nullglob'.
        (syntax-check): Likewise.
        (sc_cast_of_x_alloc_return_value): Likewise.
        (sc_cast_of_alloca_return_value, sc_error_exit_success)
        (sc_prohibit_jm_in_m4, .re-list, sc_unmarked_diagnostics)
        (m4-check): Likewise.
        (sc_system_h_headers): Do not print rule on execution.
        (sc_tight_scope): Do not fail for non-existing `src' directory.
        (sc_changelog): Skip the Copyright footer.
        * lib/autoconf/lang.m4: Remove trailing space.

Index: ChangeLog.0
===================================================================
RCS file: /cvsroot/autoconf/autoconf/ChangeLog.0,v
retrieving revision 1.4
diff -u -r1.4 ChangeLog.0
--- ChangeLog.0 14 May 2005 07:00:38 -0000      1.4
+++ ChangeLog.0 6 Apr 2006 16:16:57 -0000
@@ -298,7 +298,7 @@
        was given, even if not substituting for prefix.
 
        * acgeneral.m4 (AC_INIT, AC_OUTPUT): Remove @VPATH@
-       substitution; use @srcdir@ instead. 
+       substitution; use @srcdir@ instead.
 
 Sun May  3 01:21:47 1992  David J. MacKenzie  ([EMAIL PROTECTED])
 
Index: Makefile.maint
===================================================================
RCS file: /cvsroot/autoconf/autoconf/Makefile.maint,v
retrieving revision 1.34
diff -u -r1.34 Makefile.maint
--- Makefile.maint      30 Mar 2006 19:54:08 -0000      1.34
+++ Makefile.maint      6 Apr 2006 16:16:57 -0000
@@ -107,32 +107,37 @@
   sc_texi_notab
 
 syntax-check: $(syntax-check-rules)
-#      @grep -nE '#  *include <(limits|std(def|arg|bool))\.h>'         \
-#          $$(find -type f -name '*.[chly]') &&                        \
+#      @shopt -s nullglob;                                             \
+#      grep -nE '#  *include <(limits|std(def|arg|bool))\.h>'          \
+#          $$(find -type f -name '*.[chly]') /dev/null &&              \
 #        { echo '$(ME): found conditional include' 1>&2;               \
 #          exit 1; } || :
 
 #      grep -nE '^#  *include <(string|stdlib)\.h>'                    \
-#          $(srcdir)/{lib,src}/*.[chy] &&                              \
+#          $(srcdir)/{lib,src}/*.[chy] /dev/null &&                    \
 #        { echo '$(ME): FIXME' 1>&2;                                   \
 #          exit 1; } || :
 # FIXME: don't allow `#include .strings\.h' anywhere
 
 sc_cast_of_argument_to_free:
-       @grep -nE '\<free \(\(' $(srcdir)/{lib,src}/*.[chly] &&         \
+       @shopt -s nullglob;                                             \
+       grep -nE '\<free \(\('                                          \
+           $(srcdir)/{lib,src}/*.[chly] /dev/null &&                   \
          { echo '$(ME): don'\''t cast free argument' 1>&2;             \
            exit 1; } || :
 
 sc_cast_of_x_alloc_return_value:
-       @grep -nE --exclude=$(srcdir)/lib/regex.c                       \
+       @shopt -s nullglob;                                             \
+       grep -nE --exclude=$(srcdir)/lib/regex.c                        \
            '\*\) *x(m|c|re)alloc\>'                                    \
-           $(srcdir)/{lib,src}/*.[chy] &&                              \
+           $(srcdir)/{lib,src}/*.[chy] /dev/null &&                    \
          { echo '$(ME): don'\''t cast x*alloc return value' 1>&2;      \
            exit 1; } || :
 
 sc_cast_of_alloca_return_value:
-       @grep -nE '\*\) *alloca\>'                                      \
-           $(srcdir)/src/*.[chy] &&                                    \
+       @shopt -s nullglob;                                             \
+       grep -nE '\*\) *alloca\>'                                       \
+           $(srcdir)/src/*.[chy] /dev/null &&                          \
          { echo '$(ME): don'\''t cast alloca return value' 1>&2;       \
            exit 1; } || :
 
@@ -154,8 +159,8 @@
 # Using EXIT_SUCCESS as the first argument to error is misleading,
 # since when that parameter is 0, error does not exit.  Use `0' instead.
 sc_error_exit_success:
-       @grep -nF 'error (EXIT_SUCCESS,'                                        
\
-           $$(find -type f -name '*.[chly]') &&                        \
+       @grep -nF 'error (EXIT_SUCCESS,'                                \
+           $$(find -type f -name '*.[chly]') /dev/null &&              \
          { echo '$(ME): found error (EXIT_SUCCESS' 1>&2;               \
            exit 1; } || :
 
@@ -184,7 +189,8 @@
 
 # Each nonempty line must start with a year number, or a TAB.
 sc_changelog:
-       @grep -n '^[^12 ]' $$(find . -maxdepth 2 -name ChangeLog) &&    \
+       @sed '/^-----/,$$d' $$(find . -maxdepth 2 -name ChangeLog)      \
+         | grep -n '^[^12      ]' &&                                   \
          { echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2;  \
            exit 1; } || :
 
@@ -209,7 +215,7 @@
 # On 2004-04-13, they were all changed to start with gl_ instead.
 # Make sure that none are inadvertently reintroduced.
 sc_prohibit_jm_in_m4:
-       @grep -nE 'jm_[A-Z]'                                            \
+       @grep -nE 'jm_[A-Z]' /dev/null                                  \
                $$($(CVS_LIST) $(srcdir)/m4 |grep '\.m4$$') &&          \
            { echo '$(ME): do not use jm_ in m4 macro names'            \
              1>&2; exit 1; } || :
@@ -229,8 +235,9 @@
 # Create a list of regular expressions matching the names
 # of files included from system.h.  Exclude a couple.
 .re-list:
-       @sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
-         | grep -Ev 'sys/(param|file)\.h' \
+       @shopt -s nullglob;                                             \
+       sed -n '/^# *include /s///p' $(srcdir)/src/system.[h] /dev/null \
+         | grep -Ev 'sys/(param|file)\.h'                              \
          | sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
          > [EMAIL PROTECTED]
        @mv [EMAIL PROTECTED] $@
@@ -238,7 +245,7 @@
 # Files in src/ should not include directly any of
 # the headers already included via system.h.
 sc_system_h_headers: .re-list
-       if test -f $(srcdir)/src/system.h; then                 \
+       @if test -f $(srcdir)/src/system.h; then                                
\
          trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15;          \
          grep -nE -f .re-list                                          \
              $$($(CVS_LIST) src |                                      \
@@ -255,7 +262,7 @@
            exit 1; } || :
 
 sc_tight_scope:
-       $(MAKE) -C src $@
+       @if test -d src; then $(MAKE) -C src $@; else :; fi
 
 sc_trailing_space:
        @grep -n '[      ]$$'                                           \
@@ -266,8 +273,9 @@
 # Look for diagnostics that aren't marked for translation.
 # This won't find any for which error's format string is on a separate line.
 sc_unmarked_diagnostics:
-       @grep -nE                                                       \
-           '\<error \([^"]*"[^"]*[a-z]{3}' $(srcdir)/{lib,src}/*.c     \
+       @shopt -s nullglob;                                             \
+       grep -nE '\<error \([^"]*"[^"]*[a-z]{3}'                        \
+           $(srcdir)/{lib,src}/*.c /dev/null                           \
          | grep -v '_(' &&                                             \
          { echo '$(ME): found unmarked diagnostic(s)' 1>&2;            \
            exit 1; } || :
@@ -312,7 +320,8 @@
        fi
 
 m4-check:
-       @grep 'AC_DEFUN([^[]' m4/*.m4 \
+       @shopt -s nullglob;                                             \
+       grep 'AC_DEFUN([^[]' m4/*.m4 /dev/null                          \
          && { echo 'Makefile.maint: quote the first arg to AC_DEFUN' 1>&2; \
               exit 1; } || :
 
Index: lib/autoconf/lang.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/lang.m4,v
retrieving revision 1.177
diff -u -r1.177 lang.m4
--- lib/autoconf/lang.m4        2 Apr 2006 16:38:54 -0000       1.177
+++ lib/autoconf/lang.m4        6 Apr 2006 16:16:59 -0000
@@ -428,7 +428,7 @@
 #
 # - *.xSYM
 #   Created on BeOS.  Seems to be per executable.
-# 
+#
 # - *.map, *.inf
 #   Created by the Green Hills compiler.
 

Reply via email to