Convert aos over to flatbuffers
Everything builds, and all the tests pass. I suspect that some entries
are missing from the config files, but those will be found pretty
quickly on startup.
There is no logging or live introspection of queue messages.
Change-Id: I496ee01ed68f202c7851bed7e8786cee30df29f5
diff --git a/aos/mutex/BUILD b/aos/mutex/BUILD
index 43c9616..e698f62 100644
--- a/aos/mutex/BUILD
+++ b/aos/mutex/BUILD
@@ -9,10 +9,9 @@
"mutex.h",
],
deps = [
- "//aos:die",
- "//aos/type_traits:type_traits",
- "//aos/logging",
"//aos/ipc_lib:aos_sync",
+ "//aos/type_traits",
+ "@com_github_google_glog//:glog",
],
)
@@ -22,14 +21,13 @@
"mutex_test.cc",
],
deps = [
- "//aos:die",
":mutex",
- "//aos/time:time",
- "//aos/logging",
- "//aos/util:death_test_log_implementation",
- "//aos/util:thread",
"//aos/testing:googletest",
"//aos/testing:test_logging",
"//aos/testing:test_shm",
+ "//aos/time",
+ "//aos/util:death_test_log_implementation",
+ "//aos/util:thread",
+ "@com_github_google_glog//:glog",
],
)
diff --git a/aos/mutex/mutex.cc b/aos/mutex/mutex.cc
index c5570aa..ef4fbbe 100644
--- a/aos/mutex/mutex.cc
+++ b/aos/mutex/mutex.cc
@@ -5,7 +5,7 @@
#include <string.h>
#include "aos/type_traits/type_traits.h"
-#include "aos/logging/logging.h"
+#include "glog/logging.h"
namespace aos {
@@ -19,8 +19,8 @@
} else if (ret == 1) {
return true;
} else {
- AOS_LOG(FATAL, "mutex_grab(%p(=%" PRIu32 ")) failed with %d\n", &impl_,
- impl_.futex, ret);
+ LOG(FATAL) << "mutex_grab(" << &impl_ << "(=" << std::hex << impl_.futex
+ << ")) failed with " << ret;
}
}
@@ -38,8 +38,8 @@
case 4:
return State::kLockFailed;
default:
- AOS_LOG(FATAL, "mutex_trylock(%p(=%" PRIu32 ")) failed with %d\n", &impl_,
- impl_.futex, ret);
+ LOG(FATAL) << "mutex_trylock(" << &impl_ << "(=" << std::hex
+ << impl_.futex << ")) failed with " << ret;
}
}
diff --git a/aos/mutex/mutex.h b/aos/mutex/mutex.h
index ad678cc..a2af7ae 100644
--- a/aos/mutex/mutex.h
+++ b/aos/mutex/mutex.h
@@ -1,10 +1,10 @@
#ifndef AOS_MUTEX_H_
#define AOS_MUTEX_H_
+#include "aos/ipc_lib/aos_sync.h"
#include "aos/macros.h"
#include "aos/type_traits/type_traits.h"
-#include "aos/die.h"
-#include "aos/ipc_lib/aos_sync.h"
+#include "glog/logging.h"
namespace aos {
@@ -73,8 +73,8 @@
public:
explicit MutexLocker(Mutex *mutex) : mutex_(mutex) {
if (__builtin_expect(mutex_->Lock(), false)) {
- ::aos::Die("previous owner of mutex %p died but it shouldn't be able to",
- this);
+ LOG(FATAL) << "previous owner of mutex " << this
+ << " died but it shouldn't be able to";
}
}
~MutexLocker() {
@@ -95,13 +95,14 @@
: mutex_(mutex), owner_died_(mutex_->Lock()) {}
~IPCMutexLocker() {
if (__builtin_expect(!owner_died_checked_, false)) {
- ::aos::Die("nobody checked if the previous owner of mutex %p died", this);
+ LOG(FATAL) << "nobody checked if the previous owner of mutex " << this
+ << " died";
}
mutex_->Unlock();
}
// Whether or not the previous owner died. If this is not called at least
- // once, the destructor will ::aos::Die.
+ // once, the destructor will LOG(FATAL)
__attribute__((warn_unused_result)) bool owner_died() {
owner_died_checked_ = true;
return __builtin_expect(owner_died_, false);
@@ -125,13 +126,14 @@
owner_died_(locked_ ? mutex_->Lock() : false) {}
~IPCRecursiveMutexLocker() {
if (__builtin_expect(!owner_died_checked_, false)) {
- ::aos::Die("nobody checked if the previous owner of mutex %p died", this);
+ LOG(FATAL) << "nobody checked if the previous owner of mutex " << this
+ << " died";
}
if (locked_) mutex_->Unlock();
}
// Whether or not the previous owner died. If this is not called at least
- // once, the destructor will ::aos::Die.
+ // once, the destructor will LOG(FATAL)
__attribute__((warn_unused_result)) bool owner_died() {
owner_died_checked_ = true;
return __builtin_expect(owner_died_, false);
diff --git a/aos/mutex/mutex_test.cc b/aos/mutex/mutex_test.cc
index 9d371b7..cc659a5 100644
--- a/aos/mutex/mutex_test.cc
+++ b/aos/mutex/mutex_test.cc
@@ -10,13 +10,13 @@
#include "gtest/gtest.h"
#include "aos/die.h"
-#include "aos/time/time.h"
-#include "aos/util/death_test_log_implementation.h"
-#include "aos/util/thread.h"
#include "aos/ipc_lib/aos_sync.h"
#include "aos/ipc_lib/core_lib.h"
#include "aos/testing/test_logging.h"
#include "aos/testing/test_shm.h"
+#include "aos/time/time.h"
+#include "aos/util/death_test_log_implementation.h"
+#include "aos/util/thread.h"
namespace aos {
namespace testing {