summaryrefslogtreecommitdiff
path: root/maint.mk
diff options
context:
space:
mode:
Diffstat (limited to 'maint.mk')
-rw-r--r--maint.mk17
1 files changed, 17 insertions, 0 deletions
diff --git a/maint.mk b/maint.mk
index 73ea8eaec1..34d66e1d14 100644
--- a/maint.mk
+++ b/maint.mk
@@ -289,6 +289,23 @@ sc_prohibit_error_without_use:
re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? *\('\
$(_header_without_use)
+# Don't include xalloc.h unless you use one of its functions.
+# Consider these symbols:
+# perl -lne '/^# *define (\w+)\(/ and print $1' lib/xalloc.h|grep -v '^__';
+# perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) \(/ and print $1' lib/xalloc.h
+# Divide into two sets on case, and filter each through this:
+# | sort | perl -MRegexp::Assemble -le \
+# 'print Regexp::Assemble->new(file => "/dev/stdin")->as_string'|sed 's/\?://g'
+# Note this was produced by the above:
+# _xa1 = x(alloc_(oversized|die)|([cz]|2?re)alloc|m(alloc|emdup)|strdup)
+# But we can do better:
+_xa1 = x(alloc_(oversized|die)|([cmz]|2?re)alloc|(mem|str)dup)
+_xa2 = X([CZ]|N?M)ALLOC
+sc_prohibit_xalloc_without_use:
+ @h='"xalloc.h"' \
+ re='\<($(_xa1)|$(_xa2)) *\('\
+ $(_header_without_use)
+
sc_prohibit_safe_read_without_use:
@h='"safe-read.h"' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \
$(_header_without_use)