changeset 14140:1ca84334d3eb

maint.mk: improve sc_prohibit_strcmp regex * top/maint.mk (sc_prohibit_strcmp): Detect strcmp()!=0, as documented. Also, detect strcmp((expr),expr) == 0. Exempt the definition of STRNEQ. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Thu, 06 Jan 2011 14:24:57 -0700
parents 70efe04c9de0
children bc576551c57c
files ChangeLog top/maint.mk
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-01-06  Eric Blake  <eblake@redhat.com>
 
+	maint.mk: improve sc_prohibit_strcmp regex
+	* top/maint.mk (sc_prohibit_strcmp): Detect strcmp()!=0, as
+	documented.  Also, detect strcmp((expr),expr) == 0.  Exempt the
+	definition of STRNEQ.
+
 	signal: work around Haiku issue with SIGBUS
 	* lib/siglist.h: Add comment.
 	* lib/sig2str.c (numname_table): Swap SIGBUS order, to match
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -292,10 +292,10 @@
 
 # Use STREQ rather than comparing strcmp == 0, or != 0.
 sc_prohibit_strcmp:
-	@grep -nE '! *str''cmp *\(|\<str''cmp *\([^)]+\) *=='		\
+	@grep -nE '! *str''cmp *\(|\<str''cmp *\(.+\) *[!=]='	\
 	    $$($(VC_LIST_EXCEPT))					\
-	  | grep -vE ':# *define STREQ\(' &&				\
-	  { echo '$(ME): use STREQ in place of the above uses of str''cmp' \
+	  | grep -vE ':# *define STRN?EQ\(' &&				\
+	  { echo '$(ME): replace str''cmp calls above with STREQ/STRNEQ' \
 		1>&2; exit 1; } || :
 
 # Pass EXIT_*, not number, to usage, exit, and error (when exiting)