diff options
author | Jim Meyering <meyering@redhat.com> | 2009-11-20 13:24:24 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2009-11-20 13:24:24 +0100 |
commit | 00b2f10b68593189be4eb1affd88de33a8e92fb3 (patch) | |
tree | cd3a2f47b873543db03f612b22224ab2f7e143d4 /top | |
parent | b5104eb4ff3b34f51ffd22d83e45477f134361e4 (diff) | |
download | gnulib-00b2f10b68593189be4eb1affd88de33a8e92fb3.tar.gz |
maint.mk: improve sc_prohibit_magic_number_exit
* top/maint.mk (sc_prohibit_magic_number_exit): Tighten regexp
so it does not match uses like System.exit(1).
Add comments showing how to correct all offenders.
Diffstat (limited to 'top')
-rw-r--r-- | top/maint.mk | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/top/maint.mk b/top/maint.mk index 34d66e1d14..3452a1588c 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -157,8 +157,17 @@ sc_prohibit_strcmp: 1>&2; exit 1; } || : # Pass EXIT_*, not number, to usage, exit, and error (when exiting) +# Convert all uses automatically, via these two commands: +# git grep -l '\<exit *(1)' \ +# | grep -vEf .x-sc_prohibit_magic_number_exit \ +# | xargs --no-run-if-empty \ +# perl -pi -e 's/(^|[^.])\b(exit ?)\(1\)/$1$2(EXIT_FAILURE)/' +# git grep -l '\<exit *(0)' \ +# | grep -vEf .x-sc_prohibit_magic_number_exit \ +# | xargs --no-run-if-empty \ +# perl -pi -e 's/(^|[^.])\b(exit ?)\(0\)/$1$2(EXIT_SUCCESS)/' sc_prohibit_magic_number_exit: - @re='\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,' \ + @re='(^|[^.])\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,' \ msg='use EXIT_* values rather than magic number' \ $(_prohibit_regexp) |