[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: prohibit_strcmp
From: |
Jim Meyering |
Subject: |
Re: prohibit_strcmp |
Date: |
Thu, 23 Feb 2012 18:20:27 +0100 |
Akim Demaille wrote:
> Also, FWIW, in Bison there are many more strcmp, but they do not
> conform to the sc pattern.
>
> src/ielr.c: if (0 == strcmp (type, "lalr"))
> src/ielr.c: else if (0 == strcmp (type, "ielr"))
> src/ielr.c: else if (0 == strcmp (type, "canonical-lr"))
How about this?
diff --git a/top/maint.mk b/top/maint.mk
index 1dd6493..2841773 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -303,8 +303,10 @@ sc_prohibit_atoi_atof:
$(_sc_search_regexp)
# Use STREQ rather than comparing strcmp == 0, or != 0.
+s_ = str''cmp
+sp_ = $(s_) *\(.+\)
sc_prohibit_strcmp:
- @grep -nE '! *str''cmp *\(|\<str''cmp *\(.+\) *[!=]=' \
+ @grep -nE '! *$(s_) *\(|\<$(sp_) *[!=]=|[!=]= *$(sp_)' \
$$($(VC_LIST_EXCEPT)) \
| grep -vE ':# *define STRN?EQ\(' && \
{ echo '$(ME): replace str''cmp calls above with STREQ/STRNEQ' \