maint.mk: forbid exit(-1)
[gnulib.git] / top / maint.mk
index 5ca1a31..b39e9ae 100644 (file)
@@ -61,7 +61,7 @@ endif
 # (i.e., with no $(srcdir) prefix), this definition is careful to
 # remove any $(srcdir) prefix, and to restore what it removes.
 _sc_excl = \
-  $(if $(exclude_file_name_regexp--$@),$(exclude_file_name_regexp--$@),^$$)
+  $(or $(exclude_file_name_regexp--$@),^$$)
 VC_LIST_EXCEPT = \
   $(VC_LIST) | sed 's|^$(_dot_escaped_srcdir)/||' \
        | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; \
@@ -353,8 +353,9 @@ sc_prohibit_strncpy:
 #  | xargs --no-run-if-empty \
 #      perl -pi -e 's/(^|[^.])\b(exit ?)\(0\)/$1$2(EXIT_SUCCESS)/'
 sc_prohibit_magic_number_exit:
-       @prohibit='(^|[^.])\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,'     \
-       halt='use EXIT_* values rather than magic number'                       \
+       @prohibit='(^|[^.])\<(usage|exit|error) ?\(-?[0-9]+[,)]'        \
+       exclude='error ?\(0,'                                           \
+       halt='use EXIT_* values rather than magic number'               \
          $(_sc_search_regexp)
 
 # Using EXIT_SUCCESS as the first argument to error is misleading,
@@ -778,7 +779,7 @@ sc_prohibit_always_true_header_tests:
          $(_sc_search_regexp)
 
 sc_prohibit_defined_have_decl_tests:
-       prohibit='#[     ]*if(n?def|.*\<defined)\>[      (]+HAVE_DECL_' \
+       @prohibit='#[    ]*if(n?def|.*\<defined)\>[      (]+HAVE_DECL_' \
        halt='$(ME): HAVE_DECL macros are always defined'               \
          $(_sc_search_regexp)