Merge changes If2fc227f,Ib83228bd
* changes:
Fix race in localizer_test
Add logger and log reader classes.
diff --git a/aos/BUILD b/aos/BUILD
index 4f87873..8683d18 100644
--- a/aos/BUILD
+++ b/aos/BUILD
@@ -234,9 +234,6 @@
hdrs = [
"complex_thread_local.h",
],
- linkopts = [
- "-lpthread",
- ],
visibility = ["//visibility:public"],
deps = [
"//aos:die",
@@ -308,10 +305,10 @@
":flatbuffer_merge",
":flatbuffers",
":json_to_flatbuffer",
- "@com_google_absl//absl/base",
"//aos:unique_malloc_ptr",
"//aos/util:file",
"@com_github_google_glog//:glog",
+ "@com_google_absl//absl/base",
"@com_google_absl//absl/container:btree",
"@com_google_absl//absl/strings",
],
diff --git a/aos/flatbuffers.h b/aos/flatbuffers.h
index b951564..1050417 100644
--- a/aos/flatbuffers.h
+++ b/aos/flatbuffers.h
@@ -144,11 +144,7 @@
const uint8_t *data() const override {
return reinterpret_cast<const uint8_t *>(data_.data());
}
- uint8_t *data() override {
- // TODO(james): when we get c++17, can we drop the second cast?
- return const_cast<uint8_t *>(
- reinterpret_cast<const uint8_t *>(data_.data()));
- }
+ uint8_t *data() override { return reinterpret_cast<uint8_t *>(data_.data()); }
size_t size() const override { return data_.size(); }
private:
diff --git a/aos/network/BUILD b/aos/network/BUILD
index 6fe0585..d5c27b3 100644
--- a/aos/network/BUILD
+++ b/aos/network/BUILD
@@ -9,7 +9,7 @@
"team_number.h",
],
deps = [
- "//aos:once",
+ "@com_google_absl//absl/base",
"//aos/logging",
"//aos/util:string_to_num",
"//aos:configuration",
diff --git a/aos/network/team_number.cc b/aos/network/team_number.cc
index c4fa5c2..852ce93 100644
--- a/aos/network/team_number.cc
+++ b/aos/network/team_number.cc
@@ -10,7 +10,7 @@
#include "aos/logging/logging.h"
#include "aos/util/string_to_num.h"
#include "aos/configuration.h"
-#include "aos/once.h"
+#include "absl/base/call_once.h"
namespace aos {
namespace network {
@@ -51,33 +51,35 @@
return buf;
}
-uint16_t *DoGetTeamNumber() {
- if (override_team != 0) return &override_team;
-
- static uint16_t r;
+void DoGetTeamNumber(uint16_t *result) {
+ if (override_team != 0) {
+ *result = override_team;
+ return;
+ }
const char *override_number = getenv("AOS_TEAM_NUMBER");
if (override_number != nullptr) {
- if (!::aos::util::StringToNumber(override_number, &r)) {
+ if (!::aos::util::StringToNumber(override_number, result)) {
AOS_LOG(FATAL, "error parsing AOS_TEAM_NUMBER '%s'\n", override_number);
}
AOS_LOG(WARNING,
- "team number overridden by AOS_TEAM_NUMBER to %" PRIu16 "\n", r);
+ "team number overridden by AOS_TEAM_NUMBER to %" PRIu16 "\n", *result);
} else {
- int error = internal::ParseTeamNumber(GetHostname(), &r);
+ int error = internal::ParseTeamNumber(GetHostname(), result);
if (error) {
AOS_LOG(FATAL, "Invalid hostname %s\n", GetHostname().c_str());
}
- AOS_LOG(INFO, "team number is %" PRIu16 "\n", r);
+ AOS_LOG(INFO, "team number is %" PRIu16 "\n", *result);
}
- return &r;
}
} // namespace
uint16_t GetTeamNumber() {
- static Once<uint16_t> once(DoGetTeamNumber);
- return *once.Get();
+ static absl::once_flag once;
+ static uint16_t result;
+ absl::call_once(once, DoGetTeamNumber, &result);
+ return result;
}
void OverrideTeamNumber(uint16_t team) { override_team = team; }
diff --git a/frc971/wpilib/ahal/BUILD b/frc971/wpilib/ahal/BUILD
index f91b3fa..3f06ff8 100644
--- a/frc971/wpilib/ahal/BUILD
+++ b/frc971/wpilib/ahal/BUILD
@@ -14,7 +14,6 @@
name = "ahal",
srcs = glob(["*.cc"]) + [":wpilib_version"],
hdrs = glob(["*.h"]),
- linkopts = ["-lpthread"],
restricted_to = ["//tools:roborio"],
visibility = ["//third_party:__pkg__"],
deps = [
diff --git a/third_party/abseil/absl/base/BUILD.bazel b/third_party/abseil/absl/base/BUILD.bazel
index 762e954..b7754de 100644
--- a/third_party/abseil/absl/base/BUILD.bazel
+++ b/third_party/abseil/absl/base/BUILD.bazel
@@ -132,10 +132,7 @@
"internal/low_level_alloc.h",
],
copts = ABSL_DEFAULT_COPTS,
- linkopts = select({
- "//absl:windows": [],
- "//conditions:default": ["-pthread"],
- }) + ABSL_DEFAULT_LINKOPTS,
+ linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = [
"//absl:__subpackages__",
],
@@ -192,7 +189,7 @@
copts = ABSL_DEFAULT_COPTS,
linkopts = select({
"//absl:windows": [],
- "//conditions:default": ["-pthread"],
+ "//conditions:default": [],
}) + ABSL_DEFAULT_LINKOPTS,
deps = [
":atomic_hook",
diff --git a/third_party/abseil/absl/debugging/BUILD.bazel b/third_party/abseil/absl/debugging/BUILD.bazel
index 01e2ea2..3df2a8f 100644
--- a/third_party/abseil/absl/debugging/BUILD.bazel
+++ b/third_party/abseil/absl/debugging/BUILD.bazel
@@ -122,10 +122,7 @@
name = "failure_signal_handler_test",
srcs = ["failure_signal_handler_test.cc"],
copts = ABSL_TEST_COPTS,
- linkopts = select({
- "//absl:windows": [],
- "//conditions:default": ["-pthread"],
- }) + ABSL_DEFAULT_LINKOPTS,
+ linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":failure_signal_handler",
":stacktrace",
diff --git a/third_party/abseil/absl/random/internal/BUILD.bazel b/third_party/abseil/absl/random/internal/BUILD.bazel
index ec4fa53..d394045 100644
--- a/third_party/abseil/absl/random/internal/BUILD.bazel
+++ b/third_party/abseil/absl/random/internal/BUILD.bazel
@@ -109,10 +109,7 @@
"pool_urbg.h",
],
copts = ABSL_DEFAULT_COPTS,
- linkopts = select({
- "//absl:windows": [],
- "//conditions:default": ["-pthread"],
- }) + ABSL_DEFAULT_LINKOPTS,
+ linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":randen",
":seed_material",
diff --git a/third_party/abseil/absl/synchronization/BUILD.bazel b/third_party/abseil/absl/synchronization/BUILD.bazel
index 89d5538..6d640ae 100644
--- a/third_party/abseil/absl/synchronization/BUILD.bazel
+++ b/third_party/abseil/absl/synchronization/BUILD.bazel
@@ -87,10 +87,7 @@
"notification.h",
],
copts = ABSL_DEFAULT_COPTS,
- linkopts = select({
- "//absl:windows": [],
- "//conditions:default": ["-pthread"],
- }) + ABSL_DEFAULT_LINKOPTS,
+ linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":graphcycles_internal",
":kernel_timeout_internal",
diff --git a/third_party/allwpilib_2019/BUILD b/third_party/allwpilib_2019/BUILD
index cfae703..91a3d87 100644
--- a/third_party/allwpilib_2019/BUILD
+++ b/third_party/allwpilib_2019/BUILD
@@ -80,7 +80,6 @@
],
defines = ["WPILIB2019=1"],
includes = _hal_header_dirs,
- linkopts = ["-lpthread"],
restricted_to = ["//tools:roborio"],
visibility = ["//third_party:__pkg__"],
deps = [
diff --git a/third_party/google-benchmark/BUILD.bazel b/third_party/google-benchmark/BUILD.bazel
index 7ba1887..479d59e 100644
--- a/third_party/google-benchmark/BUILD.bazel
+++ b/third_party/google-benchmark/BUILD.bazel
@@ -24,7 +24,7 @@
],
linkopts = select({
":windows": ["-DEFAULTLIB:shlwapi.lib"],
- "//conditions:default": ["-pthread"],
+ "//conditions:default": [],
}),
strip_include_prefix = "include",
visibility = ["//visibility:public"],
diff --git a/third_party/googletest/googletest/test/BUILD.bazel b/third_party/googletest/googletest/test/BUILD.bazel
index 0a66ce9..7d03cac 100644
--- a/third_party/googletest/googletest/test/BUILD.bazel
+++ b/third_party/googletest/googletest/test/BUILD.bazel
@@ -107,13 +107,6 @@
"googletest/include/internal",
"googletest/test",
],
- linkopts = select({
- "//third_party/googletest:windows": [],
- "//third_party/googletest:windows_msvc": [],
- "//conditions:default": [
- "-pthread",
- ],
- }),
deps = ["//third_party/googletest:gtest_main"],
)
diff --git a/tools/cpp/CROSSTOOL b/tools/cpp/CROSSTOOL
index 21b3349..511196b 100644
--- a/tools/cpp/CROSSTOOL
+++ b/tools/cpp/CROSSTOOL
@@ -311,19 +311,6 @@
flag: "-std=gnu++1z"
}
}
- flag_set {
- action: "preprocess-assemble"
- action: "assemble"
- action: "c++-link"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- action: "c-compile"
- flag_group {
- flag: "-pthread"
- }
- }
}
feature {
name: "pie_for_linking"
diff --git a/tools/cpp/static_crosstool.pb b/tools/cpp/static_crosstool.pb
index 3435ece..5121911 100644
--- a/tools/cpp/static_crosstool.pb
+++ b/tools/cpp/static_crosstool.pb
@@ -218,20 +218,6 @@
flag: "-std=gnu++1z"
}
}
- flag_set {
- action: "preprocess-assemble"
- action: "assemble"
- action: "c++-link"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- action: "c-compile"
- flag_group {
- # We always want to compile with -pthread semantics.
- flag: "-pthread"
- }
- }
}
# Anticipated future default.
diff --git a/y2017/BUILD b/y2017/BUILD
index 8bf2ff8..96b2d92 100644
--- a/y2017/BUILD
+++ b/y2017/BUILD
@@ -11,7 +11,6 @@
],
visibility = ["//visibility:public"],
deps = [
- "//aos:once",
"//aos/logging",
"//aos/mutex",
"@com_google_absl//absl/base",
diff --git a/y2019/jevois/BUILD b/y2019/jevois/BUILD
index dc170be..f11c67c 100644
--- a/y2019/jevois/BUILD
+++ b/y2019/jevois/BUILD
@@ -31,10 +31,20 @@
" ".join(jevois_crc_args + [
"--generate=h",
"--output=$(location jevois_crc.h)",
+ "&&",
+ "sed",
+ "-i",
+ "'s/\\(Generated on \\).*/\\1redacted/'",
+ "$(location jevois_crc.h)",
]),
" ".join(jevois_crc_args + [
"--generate=c",
"--output=$(location jevois_crc.c)",
+ "&&",
+ "sed",
+ "-i",
+ "'s/\\(Generated on \\).*/\\1redacted/'",
+ "$(location jevois_crc.c)",
]),
]),
compatible_with = mcu_cpus,