[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] maint.mk: add syntax-check rule: detect unnecessary #include <st
From: |
Jim Meyering |
Subject: |
[PATCH] maint.mk: add syntax-check rule: detect unnecessary #include <stddef.h> |
Date: |
Sun, 23 Jan 2011 19:08:44 +0100 |
Here's another prohibit-header-without-use rule.
Note that applying it manually to gnulib's .h files found a few:
git ls-files|grep '\.h$' \
| xargs grep -l '^ *#include *<stddef\.h>' \
| xargs grep -wLE 'NULL|offsetof|ptrdiff_t|size_t|wchar_t'
u64.h
lib/uninorm/normalize-internal.h
xreadlink.h
The xreadlink.h use is obviously unused so
I've removed it (2nd cset, below),
but I haven't looked at the others yet.
>From fdfca9a2199b627caf94d0dbfa17f252c7b6d54d Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 23 Jan 2011 18:54:42 +0100
Subject: [PATCH] maint.mk: add syntax-check rule: detect unnecessary #include
<stddef.h>
* top/maint.mk (sc_prohibit_stddef_without_use): New rule.
---
ChangeLog | 5 +++++
top/maint.mk | 7 +++++++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5298191..203bec2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-23 Jim Meyering <address@hidden>
+
+ maint.mk: add syntax-check rule: detect unnecessary #include <stddef.h>
+ * top/maint.mk (sc_prohibit_stddef_without_use): New rule.
+
2011-01-21 Paul Eggert <address@hidden>
getopt: omit HAVE_OPTRESET, HAVE_GETOPT_CLIP from config.h
diff --git a/top/maint.mk b/top/maint.mk
index 5915814..606d42e 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -571,6 +571,13 @@ sc_prohibit_intprops_without_use:
re='\<($(_intprops_syms_re)) *\(' \
$(_sc_header_without_use)
+_stddef_syms_re = NULL|offsetof|ptrdiff_t|size_t|wchar_t
+# Prohibit the inclusion of stddef.h without an actual use.
+sc_prohibit_stddef_without_use:
+ @h='<stddef.h>' \
+ re='\<($(_stddef_syms_re)) *\(' \
+ $(_sc_header_without_use)
+
sc_obsolete_symbols:
@prohibit='\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
halt='do not use HAVE''_FCNTL_H or O'_NDELAY \
--
1.7.3.5.38.gb312b
>From 903ded6824ec18799b25957f51df356d91b43fd9 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 23 Jan 2011 19:07:52 +0100
Subject: [PATCH] xreadlink.h: remove unnecessary #include
* lib/xreadlink.h: Don't include <stddef.h>. It was not used.
---
ChangeLog | 3 +++
lib/xreadlink.h | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 203bec2..41c76b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2011-01-23 Jim Meyering <address@hidden>
+ xreadlink.h: remove unnecessary #include
+ * lib/xreadlink.h: Don't include <stddef.h>. It was not used.
+
maint.mk: add syntax-check rule: detect unnecessary #include <stddef.h>
* top/maint.mk (sc_prohibit_stddef_without_use): New rule.
diff --git a/lib/xreadlink.h b/lib/xreadlink.h
index d7d17e8..fe608a4 100644
--- a/lib/xreadlink.h
+++ b/lib/xreadlink.h
@@ -18,8 +18,6 @@
/* Written by Jim Meyering <address@hidden> */
-#include <stddef.h>
-
extern char *xreadlink (char const *filename);
#if GNULIB_XREADLINKAT
--
1.7.3.5.38.gb312b
- [PATCH] maint.mk: add syntax-check rule: detect unnecessary #include <stddef.h>,
Jim Meyering <=