maint.mk: prohibit unwarranted use of <strings.h>
authorJim Meyering <meyering@redhat.com>
Mon, 3 May 2010 08:08:20 +0000 (10:08 +0200)
committerJim Meyering <meyering@redhat.com>
Mon, 3 May 2010 08:12:46 +0000 (10:12 +0200)
* top/maint.mk (sc_prohibit_strings_without_use): Reject inclusion of
strings.h in a file that does not also use strcasecmp, strncasecmp,
ffs or ffsll.

ChangeLog
top/maint.mk

index 797a381..4378ddb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,11 @@
 
 2010-05-03  Jim Meyering  <meyering@redhat.com>
 
+       maint.mk: prohibit unwarranted use of <strings.h>
+       * top/maint.mk (sc_prohibit_strings_without_use): Reject inclusion of
+       strings.h in a file that does not also use strcasecmp, strncasecmp,
+       ffs or ffsll.
+
        maint.mk: remove obsolete comments
        * top/maint.mk: Remove stale, commented-out rules.
 
index 66dc9b6..9bca202 100644 (file)
@@ -544,6 +544,13 @@ sc_prohibit_signal_without_use:
        re='\<($(_sig_function_re)) *\(|\<($(_sig_syms_re))\>'          \
          $(_sc_header_without_use)
 
+# Prohibit the inclusion of strings.h without a sensible use.
+# Using the likes of bcmp, bcopy, bzero, index or rindex is not sensible.
+sc_prohibit_strings_without_use:
+       @h='<strings.h>'                                                \
+       re='\<(strn?casecmp|ffs(ll)?)\>'                                \
+         $(_sc_header_without_use)
+
 # Get the list of symbol names with this:
 # perl -lne '/^# *define (\w+)\(/ and print $1' lib/intprops.h|grep -v '^s'|fmt
 _intprops_names =                                                      \