summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-06-15 11:04:21 -0600
committerEric Blake <ebb9@byu.net>2009-06-15 21:05:08 -0600
commitdcc2f67b6ffab6e9def088ccbf7627edcda4bbac (patch)
treef2e6e7f96060b3b996611dbe2a6b27b365483eeb
parente06226e32481672ab9321d5caddee63fe1dab720 (diff)
downloadgnulib-dcc2f67b6ffab6e9def088ccbf7627edcda4bbac.tar.gz
memchr, memchr2: add valgrind exception
* lib/memchr.valgrind: New file. * lib/memchr2.valgrind: New file. * modules/memchr (Files): Distribute valgrind file. * modules/memchr2 (Files): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
-rw-r--r--ChangeLog6
-rw-r--r--lib/memchr.valgrind14
-rw-r--r--lib/memchr2.valgrind14
-rw-r--r--modules/memchr1
-rw-r--r--modules/memchr21
5 files changed, 36 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 5bcd64db9e..e8ffc64c75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2009-06-15 Eric Blake <ebb9@byu.net>
+ memchr, memchr2: add valgrind exception
+ * lib/memchr.valgrind: New file.
+ * lib/memchr2.valgrind: New file.
+ * modules/memchr (Files): Distribute valgrind file.
+ * modules/memchr2 (Files): Likewise.
+
docs: memchr is no longer obsolete
* MODULES.html.sh: Move memchr from obsolete to string.h section.
* lib/string.in.h (memchr): Simplify logic.
diff --git a/lib/memchr.valgrind b/lib/memchr.valgrind
new file mode 100644
index 0000000000..60f247e10d
--- /dev/null
+++ b/lib/memchr.valgrind
@@ -0,0 +1,14 @@
+# Suppress a valgrind message about use of uninitialized memory in memchr().
+# POSIX states that when the character is found, memchr must not read extra
+# bytes in an overestimated length (for example, where memchr is used to
+# implement strnlen). However, we use a safe word read to provide a speedup.
+{
+ memchr-value4
+ Memcheck:Value4
+ fun:rpl_memchr
+}
+{
+ memchr-value8
+ Memcheck:Value8
+ fun:rpl_memchr
+}
diff --git a/lib/memchr2.valgrind b/lib/memchr2.valgrind
new file mode 100644
index 0000000000..778fe867dc
--- /dev/null
+++ b/lib/memchr2.valgrind
@@ -0,0 +1,14 @@
+# Suppress a valgrind message about use of uninitialized memory in memchr2().
+# Like memchr, it is safe to overestimate the length when the terminator
+# is guaranteed to be found. In this case, we may end up reading a word
+# that is partially uninitialized, but this use is OK for a speedup.
+{
+ memchr2-value4
+ Memcheck:Value4
+ fun:memchr2
+}
+{
+ memchr2-value8
+ Memcheck:Value8
+ fun:memchr2
+}
diff --git a/modules/memchr b/modules/memchr
index a77bec585a..855c8dbd4d 100644
--- a/modules/memchr
+++ b/modules/memchr
@@ -3,6 +3,7 @@ memchr() function: scan memory for a byte.
Files:
lib/memchr.c
+lib/memchr.valgrind
m4/memchr.m4
m4/mmap-anon.m4
diff --git a/modules/memchr2 b/modules/memchr2
index 88337acff6..99e4b856a4 100644
--- a/modules/memchr2
+++ b/modules/memchr2
@@ -4,6 +4,7 @@ memchr2() function: scan memory for the first of two bytes.
Files:
lib/memchr2.h
lib/memchr2.c
+lib/memchr2.valgrind
Depends-on:
stdint