Merge "Get most of the code actually working with most sanitizers"
diff --git a/aos/common/BUILD b/aos/common/BUILD
index 4262b60..4d0127b 100644
--- a/aos/common/BUILD
+++ b/aos/common/BUILD
@@ -30,7 +30,7 @@
'//aos/testing:googletest',
'//aos/common/logging',
'//aos/linux_code/ipc_lib:shared_mem',
- '//aos/linux_code/ipc_lib:mutex',
+ ':mutex',
],
)
@@ -58,7 +58,7 @@
],
deps = [
'//aos/common/logging:logging_interface',
- '//aos/linux_code/ipc_lib:mutex',
+ ':mutex',
':macros',
'//aos/linux_code/ipc_lib:shared_mem',
],
@@ -89,23 +89,17 @@
)
cc_library(
- name = 'real_event',
- visibility = ['//aos/linux_code/ipc_lib:__pkg__'],
+ name = 'event',
hdrs = [
'event.h',
],
+ srcs = [
+ 'event.cc',
+ ],
deps = [
'//aos/linux_code/ipc_lib:aos_sync',
':time',
- ],
-)
-
-cc_library(
- # Use this one!
- # TODO(Brian): Remove this mess...
- name = 'event',
- deps = [
- '//aos/linux_code/ipc_lib:event',
+ '//aos/common/logging:logging_interface',
],
)
@@ -130,7 +124,7 @@
':generated_queue_headers',
'//aos/linux_code/ipc_lib:shared_mem',
'//aos/linux_code/ipc_lib:core_lib',
- '//aos/linux_code/ipc_lib:mutex',
+ ':mutex',
'//aos/common/logging:logging_printf_formats',
':time',
':byteorder'
@@ -295,7 +289,7 @@
],
deps = [
'//aos/testing:googletest',
- '//aos/linux_code/ipc_lib:mutex',
+ ':mutex',
':die',
'//aos/common/logging',
'//aos/common/util:death_test_log_implementation',
@@ -319,19 +313,17 @@
)
cc_library(
- name = 'real_condition',
- visibility = ['//aos/linux_code/ipc_lib:__pkg__'],
+ name = 'condition',
hdrs = [
'condition.h',
],
-)
-
-cc_library(
- # Use this one!
- # TODO(Brian): Remove this mess...
- name = 'condition',
+ srcs = [
+ 'condition.cc',
+ ],
deps = [
- '//aos/linux_code/ipc_lib:condition',
+ ':mutex',
+ '//aos/linux_code/ipc_lib:aos_sync',
+ '//aos/common/logging:logging_interface',
],
)
@@ -345,7 +337,7 @@
':condition',
'//aos/common/util:thread',
':time',
- '//aos/linux_code/ipc_lib:mutex',
+ ':mutex',
'//aos/common/logging',
':queue_testutils',
'//aos/linux_code/ipc_lib:core_lib',
@@ -381,9 +373,14 @@
hdrs = [
'mutex.h',
],
+ srcs = [
+ 'mutex.cc',
+ ],
deps = [
'//aos/linux_code/ipc_lib:aos_sync',
':die',
+ '//aos/common/logging:logging_interface',
+ ':type_traits',
],
)
diff --git a/aos/linux_code/ipc_lib/condition.cc b/aos/common/condition.cc
similarity index 100%
rename from aos/linux_code/ipc_lib/condition.cc
rename to aos/common/condition.cc
diff --git a/aos/linux_code/ipc_lib/event.cc b/aos/common/event.cc
similarity index 100%
rename from aos/linux_code/ipc_lib/event.cc
rename to aos/common/event.cc
diff --git a/aos/linux_code/ipc_lib/mutex.cc b/aos/common/mutex.cc
similarity index 100%
rename from aos/linux_code/ipc_lib/mutex.cc
rename to aos/common/mutex.cc
diff --git a/aos/linux_code/ipc_lib/BUILD b/aos/linux_code/ipc_lib/BUILD
index 576774e..2b90c34 100644
--- a/aos/linux_code/ipc_lib/BUILD
+++ b/aos/linux_code/ipc_lib/BUILD
@@ -67,8 +67,8 @@
'queue.h',
],
deps = [
- '//aos/linux_code/ipc_lib:condition',
- '//aos/linux_code/ipc_lib:mutex',
+ '//aos/common:condition',
+ '//aos/common:mutex',
':core_lib',
':shared_mem',
'//aos/common/logging:logging_interface',
@@ -107,7 +107,7 @@
'//aos/testing:googletest',
'//aos/common:time',
'//aos/common:queue_testutils',
- '//aos/linux_code/ipc_lib:mutex',
+ '//aos/common:mutex',
':core_lib',
'//aos/common:die',
'//aos/common/libc:dirname',
@@ -122,43 +122,3 @@
':queue',
],
)
-
-cc_library(
- name = 'condition',
- visibility = ['//aos/common:__pkg__'],
- srcs = [
- 'condition.cc',
- ],
- deps = [
- ':mutex',
- '//aos/common:real_condition',
- ':aos_sync',
- '//aos/common/logging:logging_interface',
- ],
-)
-
-cc_library(
- name = 'mutex',
- srcs = [
- 'mutex.cc',
- ],
- deps = [
- ':aos_sync',
- '//aos/common/logging:logging_interface',
- '//aos/common:type_traits',
- '//aos/common:mutex',
- ],
-)
-
-cc_library(
- name = 'event',
- visibility = ['//aos/common:__pkg__'],
- srcs = [
- 'event.cc',
- ],
- deps = [
- ':aos_sync',
- '//aos/common/logging:logging_interface',
- '//aos/common:real_event',
- ],
-)
diff --git a/debian/BUILD b/debian/BUILD
index 58f87da..29c47d7 100644
--- a/debian/BUILD
+++ b/debian/BUILD
@@ -6,6 +6,6 @@
name = libname,
deps = cpu_select({
"roborio": ['@arm-frc-linux-gnueabi-repo//:' + libname],
- "amd64": ['//external:' + libname],
+ "amd64": ['@usr_repo//:' + libname],
}),
) for libname in ['libpthread', 'libm', 'libdl', 'librt']]
diff --git a/frc971/wpilib/BUILD b/frc971/wpilib/BUILD
index 9417159..a47fbc4 100644
--- a/frc971/wpilib/BUILD
+++ b/frc971/wpilib/BUILD
@@ -22,7 +22,7 @@
':dma_edge_counting',
'//aos/linux_code:init',
'//aos/common/logging',
- '//aos/linux_code/ipc_lib:mutex',
+ '//aos/common:mutex',
],
)
diff --git a/third_party/gperftools/src/base/low_level_alloc.cc b/third_party/gperftools/src/base/low_level_alloc.cc
index 4d2ae8d..4a40816 100644
--- a/third_party/gperftools/src/base/low_level_alloc.cc
+++ b/third_party/gperftools/src/base/low_level_alloc.cc
@@ -104,7 +104,7 @@
// Return a random integer n: p(n)=1/(2**n) if 1 <= n; p(n)=0 if n < 1.
static int Random() {
- static int32 r = 1; // no locking---it's not critical
+ static uint32 r = 1; // no locking---it's not critical
ANNOTATE_BENIGN_RACE(&r, "benign race, not critical.");
int result = 1;
while ((((r = r*1103515245 + 12345) >> 30) & 1) == 0) {
diff --git a/third_party/gperftools/src/tests/sampler_test.cc b/third_party/gperftools/src/tests/sampler_test.cc
index cd64b0f..df94ee0 100755
--- a/third_party/gperftools/src/tests/sampler_test.cc
+++ b/third_party/gperftools/src/tests/sampler_test.cc
@@ -604,7 +604,7 @@
CHECK_GE(q, 0); // << rnd << " " << prng_mod_power;
}
// Test some potentially out of bounds value for rnd
- for (int i = 1; i <= 66; i++) {
+ for (int i = 1; i <= 63; i++) {
rnd = one << i;
double q = (rnd >> (prng_mod_power - 26)) + 1.0;
LOG(INFO) << "rnd = " << rnd << " i=" << i << " q=" << q;
diff --git a/third_party/gperftools/src/tests/tcmalloc_unittest.cc b/third_party/gperftools/src/tests/tcmalloc_unittest.cc
index 69698bc..1831168 100644
--- a/third_party/gperftools/src/tests/tcmalloc_unittest.cc
+++ b/third_party/gperftools/src/tests/tcmalloc_unittest.cc
@@ -725,9 +725,9 @@
// that we used the tcmalloc version of the call, and not the libc.
// Note the ... in the hook signature: we don't care what arguments
// the hook takes.
-#define MAKE_HOOK_CALLBACK(hook_type) \
+#define MAKE_HOOK_CALLBACK(hook_type, args...) \
static volatile int g_##hook_type##_calls = 0; \
- static void IncrementCallsTo##hook_type(...) { \
+ static void IncrementCallsTo##hook_type(args) { \
g_##hook_type##_calls++; \
} \
static void Verify##hook_type##WasCalled() { \
@@ -744,12 +744,14 @@
}
// We do one for each hook typedef in malloc_hook.h
-MAKE_HOOK_CALLBACK(NewHook);
-MAKE_HOOK_CALLBACK(DeleteHook);
-MAKE_HOOK_CALLBACK(MmapHook);
-MAKE_HOOK_CALLBACK(MremapHook);
-MAKE_HOOK_CALLBACK(MunmapHook);
-MAKE_HOOK_CALLBACK(SbrkHook);
+MAKE_HOOK_CALLBACK(NewHook, const void*, size_t);
+MAKE_HOOK_CALLBACK(DeleteHook, const void*);
+MAKE_HOOK_CALLBACK(MmapHook, const void*, const void*, size_t, int, int, int,
+ off_t);
+MAKE_HOOK_CALLBACK(MremapHook, const void*, const void*, size_t, size_t, int,
+ const void*);
+MAKE_HOOK_CALLBACK(MunmapHook, const void *, size_t);
+MAKE_HOOK_CALLBACK(SbrkHook, const void *, ptrdiff_t);
static void TestAlignmentForSize(int size) {
fprintf(LOGSTREAM, "Testing alignment of malloc(%d)\n", size);
@@ -1279,9 +1281,9 @@
VerifyMunmapHookWasCalled();
close(fd);
#else // this is just to quiet the compiler: make sure all fns are called
- IncrementCallsToMmapHook();
- IncrementCallsToMunmapHook();
- IncrementCallsToMremapHook();
+ IncrementCallsToMmapHook(NULL, NULL, 0, 0, 0, 0, 0);
+ IncrementCallsToMunmapHook(NULL, 0);
+ IncrementCallsToMremapHook(NULL, NULL, 0, 0, 0, NULL);
VerifyMmapHookWasCalled();
VerifyMremapHookWasCalled();
VerifyMunmapHookWasCalled();
@@ -1302,7 +1304,7 @@
CHECK(p1 != NULL);
CHECK_EQ(g_SbrkHook_calls, 0);
#else // this is just to quiet the compiler: make sure all fns are called
- IncrementCallsToSbrkHook();
+ IncrementCallsToSbrkHook(NULL, 0);
VerifySbrkHookWasCalled();
#endif