Merge patch from JeremyF:

27-nvalgrind

Make valgrind.h pay attention to the preprocessor symbol NVALGRIND. If
defined, it compiles out the Valgrind magic sequence and just assigns
the result with the default return. This is analogous to NDEBUG's
effect on assert().


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1320 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/include/valgrind.h b/include/valgrind.h
index 789d65d..dad18ee 100644
--- a/include/valgrind.h
+++ b/include/valgrind.h
@@ -76,6 +76,7 @@
 
 
 
+#ifndef NVALGRIND
 /* This defines the magic code sequence which the JITter spots and
    handles magically.  Don't look too closely at this; it will rot
    your brain.  Valgrind dumps the result value in %EDX, so we first
@@ -111,7 +112,22 @@
                  : "eax", "edx", "cc", "memory"                         \
                 );                                                      \
   }
-
+#else  /* NVALGRIND */
+/* Define NVALGRIND to completely remove the Valgrind magic sequence
+   from the compiled code (analogous to NDEBUG's effects on
+   assert())  */
+#define VALGRIND_MAGIC_SEQUENCE(					\
+        _zzq_rlval,   /* result lvalue */				\
+        _zzq_default, /* result returned when running on real CPU */	\
+        _zzq_request, /* request code */				\
+        _zzq_arg1,    /* request first param */				\
+        _zzq_arg2,    /* request second param */			\
+        _zzq_arg3,    /* request third param */				\
+        _zzq_arg4     /* request fourth param */ )			\
+   {									\
+      (_zzq_rlval) = (_zzq_default);					\
+   }
+#endif /* NVALGRIND */
 
 /* Some request codes.  There are many more of these, but most are not
    exposed to end-user view.  These are the public ones, all of the