bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] maint.mk: prohibit unwarranted use of <strings.h>


From: Jim Meyering
Subject: [PATCH] maint.mk: prohibit unwarranted use of <strings.h>
Date: Mon, 03 May 2010 10:12:25 +0200

I think we all agree that uses of bcmp, bcopy, bzero, index and rindex
should have been removed from our code at least 10 years ago,
so unless you use strcasecmp, strncasecmp, ffs or ffsll, you have
no reason to include strings.h.

>From 0bbf667efe89bf63421ea7f0c4566eec261199fd Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 3 May 2010 10:08:20 +0200
Subject: [PATCH] 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.
---
 ChangeLog    |    5 +++++
 top/maint.mk |    7 +++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2f7dd45..6d2e262 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-05-03  Jim Meyering  <address@hidden>

+       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.

diff --git a/top/maint.mk b/top/maint.mk
index 66dc9b6..9bca202 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -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 =                                                      \
--
1.7.1.335.g6845a




reply via email to

[Prev in Thread] Current Thread [Next in Thread]