changeset 12208:a377ab624fcc

maint: detect usage(1) and other suspicious exits * top/maint.mk (sc_prohibit_magic_number_exit): New rule. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Thu, 29 Oct 2009 07:29:26 -0600
parents 35acba1c7bcd
children 31e5813d01e1
files ChangeLog top/maint.mk
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Oct 29 11:52:34 2009 +0100
+++ b/ChangeLog	Thu Oct 29 07:29:26 2009 -0600
@@ -1,3 +1,8 @@
+2009-10-29  Eric Blake  <ebb9@byu.net>
+
+	maint: detect usage(1) and other suspicious exits
+	* top/maint.mk (sc_prohibit_magic_number_exit): New rule.
+
 2009-10-29  Jim Meyering  <meyering@redhat.com>
 
 	timespec: long-to-int truncation could make timespec_cmp malfunction
--- a/top/maint.mk	Thu Oct 29 11:52:34 2009 +0100
+++ b/top/maint.mk	Thu Oct 29 07:29:26 2009 -0600
@@ -156,6 +156,12 @@
 	  { echo '$(ME): use STREQ in place of the above uses of str''cmp' \
 		1>&2; exit 1; } || :
 
+# Pass EXIT_*, not number, to usage, exit, and error (when exiting)
+sc_prohibit_magic_number_exit:
+	@re='\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,'		\
+	msg='use EXIT_* values rather than magic number'		\
+	  $(_prohibit_regexp)
+
 # 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: