maint.mk: add syntax-check rule: detect unnecessary #include <stddef.h>
authorJim Meyering <meyering@redhat.com>
Sun, 23 Jan 2011 17:54:42 +0000 (18:54 +0100)
committerJim Meyering <meyering@redhat.com>
Sun, 23 Jan 2011 18:09:08 +0000 (19:09 +0100)
* top/maint.mk (sc_prohibit_stddef_without_use): New rule.

ChangeLog
top/maint.mk

index 5425c6616c4726c6130dd690b32551a8c885a73d..bba6c35318ed6ef301334651ae7c87709050d3d3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-23  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: add syntax-check rule: detect unnecessary #include <stddef.h>
+       * top/maint.mk (sc_prohibit_stddef_without_use): New rule.
+
 2011-01-23  Bruno Haible  <bruno@clisp.org>
 
        get-rusage-as: Fix bug.
index 5915814c11b32d6b38d3ece853febc7dc3f9c482..606d42ed18d503a18d6d228fbbf9a73974a6d82f 100644 (file)
@@ -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                    \