Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4088)

Unified Diff: base/third_party/dynamic_annotations/dynamic_annotations.c

Issue 6982022: Merge the dynamic annotations from ThreadSanitizer r3424. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/third_party/dynamic_annotations/dynamic_annotations.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/third_party/dynamic_annotations/dynamic_annotations.c
===================================================================
--- base/third_party/dynamic_annotations/dynamic_annotations.c (revision 84779)
+++ base/third_party/dynamic_annotations/dynamic_annotations.c (working copy)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2009, Google Inc.
+/* Copyright (c) 2011, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -22,9 +22,6 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ---
- * Author: Kostya Serebryany
*/
#ifdef _MSC_VER
@@ -50,82 +47,172 @@
#if DYNAMIC_ANNOTATIONS_ENABLED == 1
+/* Identical code folding(-Wl,--icf=all) countermeasures.
+ This makes all Annotate* functions different, which prevents the linker from
+ folding them. */
+#ifdef __COUNTER__
+#define DYNAMIC_ANNOTATIONS_IMPL \
+ volatile short lineno = (__LINE__ << 8) + __COUNTER__; (void)lineno;
+#else
+#define DYNAMIC_ANNOTATIONS_IMPL \
+ volatile short lineno = (__LINE__ << 8); (void)lineno;
+#endif
+
+/* WARNING: always add new annotations to the end of the list.
+ Otherwise, lineno (see above) numbers for different Annotate* functions may
+ conflict. */
void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockCreate)(
- const char *file, int line, const volatile void *lock){}
+ const char *file, int line, const volatile void *lock)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockDestroy)(
- const char *file, int line, const volatile void *lock){}
+ const char *file, int line, const volatile void *lock)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockAcquired)(
- const char *file, int line, const volatile void *lock, long is_w){}
+ const char *file, int line, const volatile void *lock, long is_w)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockReleased)(
- const char *file, int line, const volatile void *lock, long is_w){}
+ const char *file, int line, const volatile void *lock, long is_w)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierInit)(
const char *file, int line, const volatile void *barrier, long count,
- long reinitialization_allowed) {}
+ long reinitialization_allowed)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierWaitBefore)(
- const char *file, int line, const volatile void *barrier) {}
+ const char *file, int line, const volatile void *barrier)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierWaitAfter)(
- const char *file, int line, const volatile void *barrier) {}
+ const char *file, int line, const volatile void *barrier)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierDestroy)(
- const char *file, int line, const volatile void *barrier) {}
+ const char *file, int line, const volatile void *barrier)
+{DYNAMIC_ANNOTATIONS_IMPL}
void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarWait)(
const char *file, int line, const volatile void *cv,
- const volatile void *lock){}
+ const volatile void *lock)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignal)(
- const char *file, int line, const volatile void *cv){}
+ const char *file, int line, const volatile void *cv)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignalAll)(
- const char *file, int line, const volatile void *cv){}
+ const char *file, int line, const volatile void *cv)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
+void DYNAMIC_ANNOTATIONS_NAME(AnnotateHappensBefore)(
+ const char *file, int line, const volatile void *obj)
+{DYNAMIC_ANNOTATIONS_IMPL};
+
+void DYNAMIC_ANNOTATIONS_NAME(AnnotateHappensAfter)(
+ const char *file, int line, const volatile void *obj)
+{DYNAMIC_ANNOTATIONS_IMPL};
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotatePublishMemoryRange)(
- const char *file, int line, const volatile void *address, long size){}
+ const char *file, int line, const volatile void *address, long size)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateUnpublishMemoryRange)(
- const char *file, int line, const volatile void *address, long size){}
+ const char *file, int line, const volatile void *address, long size)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQCreate)(
- const char *file, int line, const volatile void *pcq){}
+ const char *file, int line, const volatile void *pcq)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQDestroy)(
- const char *file, int line, const volatile void *pcq){}
+ const char *file, int line, const volatile void *pcq)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQPut)(
- const char *file, int line, const volatile void *pcq){}
+ const char *file, int line, const volatile void *pcq)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQGet)(
- const char *file, int line, const volatile void *pcq){}
+ const char *file, int line, const volatile void *pcq)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateNewMemory)(
- const char *file, int line, const volatile void *mem, long size){}
+ const char *file, int line, const volatile void *mem, long size)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateExpectRace)(
const char *file, int line, const volatile void *mem,
- const char *description){}
+ const char *description)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateFlushExpectedRaces)(
- const char *file, int line){}
+ const char *file, int line)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateBenignRace)(
const char *file, int line, const volatile void *mem,
- const char *description){}
+ const char *description)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateBenignRaceSized)(
const char *file, int line, const volatile void *mem, long size,
- const char *description){}
+ const char *description)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsUsedAsCondVar)(
- const char *file, int line, const volatile void *mu){}
+ const char *file, int line, const volatile void *mu)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsNotPHB)(
- const char *file, int line, const volatile void *mu){}
+ const char *file, int line, const volatile void *mu)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateTraceMemory)(
- const char *file, int line, const volatile void *arg){}
+ const char *file, int line, const volatile void *arg)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateThreadName)(
- const char *file, int line, const char *name){}
+ const char *file, int line, const char *name)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreReadsBegin)(
- const char *file, int line){}
+ const char *file, int line)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreReadsEnd)(
- const char *file, int line){}
+ const char *file, int line)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreWritesBegin)(
- const char *file, int line){}
+ const char *file, int line)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreWritesEnd)(
- const char *file, int line){}
+ const char *file, int line)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreSyncBegin)(
- const char *file, int line){}
+ const char *file, int line)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreSyncEnd)(
- const char *file, int line){}
+ const char *file, int line)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateEnableRaceDetection)(
- const char *file, int line, int enable){}
+ const char *file, int line, int enable)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateNoOp)(
- const char *file, int line, const volatile void *arg){}
+ const char *file, int line, const volatile void *arg)
+{DYNAMIC_ANNOTATIONS_IMPL}
+
void DYNAMIC_ANNOTATIONS_NAME(AnnotateFlushState)(
- const char *file, int line){}
+ const char *file, int line)
+{DYNAMIC_ANNOTATIONS_IMPL}
#endif /* DYNAMIC_ANNOTATIONS_ENABLED == 1 */
« no previous file with comments | « base/third_party/dynamic_annotations/dynamic_annotations.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698