aboutsummaryrefslogtreecommitdiff
path: root/test/tsan/test.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/tsan/test.h')
-rw-r--r--test/tsan/test.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/tsan/test.h b/test/tsan/test.h
index 4496e56cda87..bb861b07745e 100644
--- a/test/tsan/test.h
+++ b/test/tsan/test.h
@@ -29,3 +29,12 @@ void barrier_init(pthread_barrier_t *barrier, unsigned count) {
// Default instance of the barrier, but a test can declare more manually.
pthread_barrier_t barrier;
+void print_address(void *address) {
+// On FreeBSD, the %p conversion specifier works as 0x%x and thus does not match
+// to the format used in the diagnotic message.
+#ifdef __x86_64__
+ fprintf(stderr, "0x%012lx", (unsigned long) address);
+#elif defined(__mips64)
+ fprintf(stderr, "0x%010lx", (unsigned long) address);
+#endif
+}