summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-12-12 08:16:52 -0500
committerEric S. Raymond <esr@thyrsus.com>2010-12-12 08:16:52 -0500
commit4c66db3fb1677cd84d9afb86334fa5d8a256fb60 (patch)
treeb5821f23ea1b24327ba5a67d858ac542a8f7b021
parent569b241539f70a95f4bf5475b4bb5dddf2dbc451 (diff)
downloaddeheader-4c66db3fb1677cd84d9afb86334fa5d8a256fb60.tar.gz
deheader-4c66db3fb1677cd84d9afb86334fa5d8a256fb60.tar.bz2
deheader-4c66db3fb1677cd84d9afb86334fa5d8a256fb60.tar.xz
deheader-4c66db3fb1677cd84d9afb86334fa5d8a256fb60.zip
Add test for calloc(3),. fix test for bzero(3).
-rwxr-xr-xdeheader2
-rw-r--r--test/calloc.c15
-rw-r--r--test/regress.chk9
3 files changed, 23 insertions, 3 deletions
diff --git a/deheader b/deheader
index d4251f8..56f3e57 100755
--- a/deheader
+++ b/deheader
@@ -57,6 +57,8 @@ requirements = map(lambda (r, h): (re.compile(r), h), (
(r"\Wbsd_signal\s*\(",["<signal.h>"]),
(r"\Wbsort\s*\(", ["<stdlib.h>"]),
(r"\Wbtowc\s*\(", ["<stdio.h>", "<wchar.h>"]),
+ (r"\Wbzero\s*\(", ["<string.h>"]),
+ (r"\Wcalloc\s*\(", ["<stdlib.h>"]),
(r"\Wumask\s*\(", ["<sys/stat.h>", "<sys/types.h>"]),
# Dependencies observed on systems other than the Linux this was
# developed under.
diff --git a/test/calloc.c b/test/calloc.c
new file mode 100644
index 0000000..04e19cd
--- /dev/null
+++ b/test/calloc.c
@@ -0,0 +1,15 @@
+/* calloc(3) needs <stdlib.h> */
+
+/*
+ * Items: calloc(
+ * Requires: <stdlib.h>
+ * Standardized-By: SuS
+ * Not-Detected-by: gcc-4.4.3 + Linux
+ */
+
+#include <stdlib.h>
+
+main(int arg, char **argv)
+{
+ (void) calloc(0, 0);
+}
diff --git a/test/regress.chk b/test/regress.chk
index 0839eb9..19bb434 100644
--- a/test/regress.chk
+++ b/test/regress.chk
@@ -1,4 +1,5 @@
deheader: ./string.c includes <string.h>
+deheader: ./bzero.c has requires <string.h> from \Wbzero\s*\(
deheader: ./bzero.c includes <string.h>
deheader: ./duplicate.c includes <stdio.h>
deheader: ./duplicate.c includes <stdio.h>
@@ -21,6 +22,8 @@ deheader: ./btowc.c has requires <stdio.h>,<wchar.h> from \Wbtowc\s*\(
deheader: ./btowc.c includes <stdio.h>
deheader: ./btowc.c includes <wchar.h>
deheader: ./abs.c includes <stdlib.h>
+deheader: ./calloc.c has requires <stdlib.h> from \Wcalloc\s*\(
+deheader: ./calloc.c includes <stdlib.h>
deheader: ./bsd_signal.c has requires <signal.h> from \Wbsd_signal\s*\(
deheader: ./bsd_signal.c includes <signal.h>
deheader: ./access.c has requires <unistd.h> from \Waccess\s*\(
@@ -85,10 +88,10 @@ deheader: remove <unistd.h> from ./sbrk.c
deheader: in ./atof.c, retaining required '#include <stdlib.h>\n'
deheader: in ./umask.c, retaining required '#include <sys/types.h>\n'
deheader: in ./umask.c, retaining required '#include <sys/stat.h>\n'
+deheader: in ./calloc.c, retaining required '#include <stdlib.h>\n'
deheader: ./abort.c without <stdlib.h> succeeded.
deheader: remove <stdlib.h> from ./abort.c
-deheader: ./bzero.c without <string.h> succeeded.
-deheader: remove <string.h> from ./bzero.c
+deheader: in ./bzero.c, retaining required '#include <string.h>\n'
deheader: in ./access.c, retaining required '#include <unistd.h>\n'
deheader: in ./btowc.c, retaining required '#include <wchar.h>\n'
deheader: in ./btowc.c, retaining required '#include <stdio.h>\n'
@@ -96,4 +99,4 @@ deheader: in ./acosh.c, retaining required '#include <math.h>\n'
deheader: in ./bcmp.c, retaining required '#include <string.h>\n'
deheader: in ./a64l.c, retaining required '#include <stdlib.h>\n'
deheader: in ./advance.c, retaining required '#include <regexp.h>\n'
-deheader: saw 30 files, 33 includes, 11 removed
+deheader: saw 31 files, 34 includes, 10 removed