Discussion:
Valgrind: r16290 - in /trunk: include/valgrind.h none/tests/Makefile.am none/tests/vgprintf_nvalgrind.stderr.exp none/tests/vgprintf_nvalgrind.vgtest
(too old to reply)
s***@valgrind.org
2017-03-30 12:14:24 UTC
Permalink
Raw Message
Author: sewardj
Date: Thu Mar 30 13:14:23 2017
New Revision: 16290

Log:
Bug 358697 - valgrind.h: Some code remains even when defining NVALGRIND.
Patch from Matthias Schwarzott (***@gentoo.org). The patch removes
a volatile memory read which was only there to stop compilers warning
about |format| being unused.

Added:
trunk/none/tests/vgprintf_nvalgrind.stderr.exp
trunk/none/tests/vgprintf_nvalgrind.vgtest
Modified:
trunk/include/valgrind.h
trunk/none/tests/Makefile.am

Modified: trunk/include/valgrind.h
==============================================================================
--- trunk/include/valgrind.h (original)
+++ trunk/include/valgrind.h Thu Mar 30 13:14:23 2017
@@ -6769,7 +6769,7 @@
VALGRIND_PRINTF(const char *format, ...)
{
#if defined(NVALGRIND)
- if (format) *(volatile const char *)format; /* avoid compiler warning */
+ (void)format;
return 0;
#else /* NVALGRIND */
#if defined(_MSC_VER) || defined(__MINGW64__)
@@ -6808,7 +6808,7 @@
VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
{
#if defined(NVALGRIND)
- if (format) *(volatile const char *)format; /* avoid compiler warning */
+ (void)format;
return 0;
#else /* NVALGRIND */
#if defined(_MSC_VER) || defined(__MINGW64__)

Modified: trunk/none/tests/Makefile.am
==============================================================================
--- trunk/none/tests/Makefile.am (original)
+++ trunk/none/tests/Makefile.am Thu Mar 30 13:14:23 2017
@@ -203,6 +203,7 @@
tls.vgtest tls.stderr.exp tls.stdout.exp \
unit_debuglog.stderr.exp unit_debuglog.vgtest \
vgprintf.stderr.exp vgprintf.vgtest \
+ vgprintf_nvalgrind.stderr.exp vgprintf_nvalgrind.vgtest \
process_vm_readv_writev.stderr.exp process_vm_readv_writev.vgtest

check_PROGRAMS = \
@@ -248,6 +249,7 @@
unit_debuglog \
valgrind_cpp_test \
vgprintf \
+ vgprintf_nvalgrind \
coolo_sigaction \
gxx304 \
process_vm_readv_writev
@@ -362,6 +364,9 @@
tls2_so_LDFLAGS = -shared
endif

+vgprintf_nvalgrind_SOURCES = vgprintf.c
+vgprintf_nvalgrind_CFLAGS = -DNVALGRIND
+
valgrind_cpp_test_SOURCES = valgrind_cpp_test.cpp
valgrind_cpp_test_LDADD = -lstdc++


Added: trunk/none/tests/vgprintf_nvalgrind.stderr.exp
==============================================================================
--- trunk/none/tests/vgprintf_nvalgrind.stderr.exp (added)
+++ trunk/none/tests/vgprintf_nvalgrind.stderr.exp Thu Mar 30 13:14:23 2017
@@ -0,0 +1,4 @@
+
+0
+0
+

Added: trunk/none/tests/vgprintf_nvalgrind.vgtest
==============================================================================
--- trunk/none/tests/vgprintf_nvalgrind.vgtest (added)
+++ trunk/none/tests/vgprintf_nvalgrind.vgtest Thu Mar 30 13:14:23 2017
@@ -0,0 +1 @@
+prog: vgprintf_nvalgrind

Loading...