Mask unused-parameter warnings in static flatbuffer codegen
Empty flatbuffer tables would result in unused parameters; just hide
those warnings.
Change-Id: Ic3d6f21d937b1056b493efc7bed33f05e750495d
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/aos/flatbuffers/static_flatbuffers.cc b/aos/flatbuffers/static_flatbuffers.cc
index e3130bb..6dceb27 100644
--- a/aos/flatbuffers/static_flatbuffers.cc
+++ b/aos/flatbuffers/static_flatbuffers.cc
@@ -599,7 +599,7 @@
// after a call to FromFlatbufferObject().
// This is a deep copy, and will call FromFlatbufferObject on
// any constituent objects.
- [[nodiscard]] bool FromFlatbuffer(const Flatbuffer::NativeTableType &other) {
+ [[nodiscard]] bool FromFlatbuffer([[maybe_unused]] const Flatbuffer::NativeTableType &other) {
Clear();
%s
return true;
@@ -653,7 +653,7 @@
// returning true on success.
// This is a deep copy, and will call FromFlatbuffer on any constituent
// objects.
- [[nodiscard]] bool FromFlatbuffer(const Flatbuffer &other) {
+ [[nodiscard]] bool FromFlatbuffer([[maybe_unused]] const Flatbuffer &other) {
Clear();
%s
return true;
diff --git a/aos/flatbuffers/test_dir/sample_test_static.h b/aos/flatbuffers/test_dir/sample_test_static.h
index 1aaf3f6..61e369a 100644
--- a/aos/flatbuffers/test_dir/sample_test_static.h
+++ b/aos/flatbuffers/test_dir/sample_test_static.h
@@ -125,7 +125,7 @@
// returning true on success.
// This is a deep copy, and will call FromFlatbuffer on any constituent
// objects.
- [[nodiscard]] bool FromFlatbuffer(const Flatbuffer &other) {
+ [[nodiscard]] bool FromFlatbuffer([[maybe_unused]] const Flatbuffer &other) {
Clear();
if (other.has_field()) {
@@ -148,7 +148,8 @@
// after a call to FromFlatbufferObject().
// This is a deep copy, and will call FromFlatbufferObject on
// any constituent objects.
- [[nodiscard]] bool FromFlatbuffer(const Flatbuffer::NativeTableType &other) {
+ [[nodiscard]] bool FromFlatbuffer(
+ [[maybe_unused]] const Flatbuffer::NativeTableType &other) {
Clear();
set_field(other.field);
@@ -333,7 +334,7 @@
// returning true on success.
// This is a deep copy, and will call FromFlatbuffer on any constituent
// objects.
- [[nodiscard]] bool FromFlatbuffer(const Flatbuffer &other) {
+ [[nodiscard]] bool FromFlatbuffer([[maybe_unused]] const Flatbuffer &other) {
Clear();
if (other.has_baz()) {
@@ -360,7 +361,8 @@
// after a call to FromFlatbufferObject().
// This is a deep copy, and will call FromFlatbufferObject on
// any constituent objects.
- [[nodiscard]] bool FromFlatbuffer(const Flatbuffer::NativeTableType &other) {
+ [[nodiscard]] bool FromFlatbuffer(
+ [[maybe_unused]] const Flatbuffer::NativeTableType &other) {
Clear();
set_baz(other.baz);
@@ -1454,7 +1456,7 @@
// returning true on success.
// This is a deep copy, and will call FromFlatbuffer on any constituent
// objects.
- [[nodiscard]] bool FromFlatbuffer(const Flatbuffer &other) {
+ [[nodiscard]] bool FromFlatbuffer([[maybe_unused]] const Flatbuffer &other) {
Clear();
if (other.has_substruct()) {
@@ -1604,7 +1606,8 @@
// after a call to FromFlatbufferObject().
// This is a deep copy, and will call FromFlatbufferObject on
// any constituent objects.
- [[nodiscard]] bool FromFlatbuffer(const Flatbuffer::NativeTableType &other) {
+ [[nodiscard]] bool FromFlatbuffer(
+ [[maybe_unused]] const Flatbuffer::NativeTableType &other) {
Clear();
if (other.substruct) {