From 83f6cdd6000b4632d094c5e36f2633fb9cf7641f Mon Sep 17 00:00:00 2001
From: "timurrrr@chromium.org"
 <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Fri, 18 Sep 2009 16:37:47 +0000
Subject: [PATCH] s/NDEBUG/NVALGRIND/g in base/dynamic_annotations.* to allow
 ThreadSanitizer runs on release binaries.

This is a copy of http://codereview.chromium.org/201060
I wasn't a commiter at that time.

Please note that http://codereview.chromium.org/195078 was submitted recently which defines NVALGRIND for non-valgrind Release builds.
Review URL: http://codereview.chromium.org/195091

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26576 0039d316-1c4b-4281-b951-d872f2087c98
---
 base/dynamic_annotations.cc |  5 ++---
 base/dynamic_annotations.h  | 15 +++++++--------
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/base/dynamic_annotations.cc b/base/dynamic_annotations.cc
index 1b1629250032f..2ee0975f8dc49 100644
--- a/base/dynamic_annotations.cc
+++ b/base/dynamic_annotations.cc
@@ -3,9 +3,8 @@
 // found in the LICENSE file.
 
 #include "base/dynamic_annotations.h"
-#include "base/third_party/valgrind/valgrind.h"
 
-#ifndef NDEBUG
+#ifndef NVALGRIND
 // Each function is empty and called (via a macro) only in debug mode.
 // The arguments are captured by dynamic tools at runtime.
 
@@ -56,7 +55,7 @@ extern "C" void AnnotateIgnoreWritesBegin(const char *file, int line) {}
 extern "C" void AnnotateIgnoreWritesEnd(const char *file, int line) {}
 extern "C" void AnnotateNoOp(const char *file, int line,
                              const volatile void *arg) {}
-#endif // NDEBUG
+#endif // NVALGRIND
 
 // When running under valgrind, a non-zero value will be returned.
 extern "C" int RunningOnValgrind() {
diff --git a/base/dynamic_annotations.h b/base/dynamic_annotations.h
index d75b773c64228..23a2a274b018f 100644
--- a/base/dynamic_annotations.h
+++ b/base/dynamic_annotations.h
@@ -17,19 +17,18 @@
 // dynamic analysis tool being used.
 //
 // This file supports the following dynamic analysis tools:
-// - None (NDEBUG is defined).
+// - None (NVALGRIND is defined).
 //    Macros are defined empty.
-// - ThreadSanitizer (NDEBUG is not defined).
+// - ThreadSanitizer (NVALGRIND is not defined).
 //    Macros are defined as calls to non-inlinable empty functions
 //    that are intercepted by ThreadSanitizer.
 //
 #ifndef BASE_DYNAMIC_ANNOTATIONS_H_
 #define BASE_DYNAMIC_ANNOTATIONS_H_
 
-// All the annotation macros are in effect only in debug mode.
-#ifndef NDEBUG
-// Debug build.
+#include "base/third_party/valgrind/valgrind.h"
 
+#ifndef NVALGRIND
 // -------------------------------------------------------------
 // Annotations useful when implementing condition variables such as CondVar,
 // using conditional critical sections (Await/LockWhen) and when constructing
@@ -309,8 +308,8 @@ inline T ANNOTATE_UNPROTECTED_READ(const volatile T &x) {
     static static_var ## _annotator the ## static_var ## _annotator;\
   }
 
-#else  // NDEBUG is defined
-// Release build, empty macros.
+#else
+// NVALGRIND is defined, empty macros.
 
 #define ANNOTATE_RWLOCK_CREATE(lock) // empty
 #define ANNOTATE_RWLOCK_DESTROY(lock) // empty
@@ -344,7 +343,7 @@ inline T ANNOTATE_UNPROTECTED_READ(const volatile T &x) {
 #define ANNOTATE_UNPROTECTED_READ(x) (x)
 #define ANNOTATE_BENIGN_RACE_STATIC(static_var, description)  // empty
 
-#endif  // NDEBUG
+#endif  // NVALGRIND
 
 // Return non-zero value if running under valgrind.
 extern "C" int RunningOnValgrind();
-- 
GitLab