diff options
author | Bill Richardson <wfrichar@google.com> | 2021-05-26 19:05:31 -0500 |
---|---|---|
committer | Bill Richardson <wfrichar@google.com> | 2021-05-27 19:59:27 +0000 |
commit | 67ee5f3f27fa0030325be4a2ddef298995783138 (patch) | |
tree | c9c3925333a4fea0d46a0fed1254de431a65b936 | |
parent | 3f268c688363102bad6c3be80726b40a6958174c (diff) | |
download | generic-67ee5f3f27fa0030325be4a2ddef298995783138.tar.gz |
Fix struct nugget_app_storage for C++
The C99 way to have zero-length arrays in a struct is "flexible
array members", aka "variable length arrays". That's okay for C,
but it's not part of C++ (although Clang claims to allow it).
There are a few C++ programs that #include app_nugget.h, so we
have to fix it up a bit.
Bug: 173056823
Test: manual
Change-Id: I0fb3d4afb27b71b7b0f8050d4b1f51f4e118514f
Signed-off-by: Bill Richardson <wfrichar@google.com>
Reviewed-on: https://nugget-os-review.googlesource.com/c/host/generic/+/43864
Reviewed-by: Randall Spangler <rspangler@google.com>
Reviewed-by: Tommy Chiu <tommychiu@google.com>
Presubmit-Verified: TreeHugger Robot <android-build-prod@system.gserviceaccount.com>
-rw-r--r-- | nugget/include/app_nugget.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/nugget/include/app_nugget.h b/nugget/include/app_nugget.h index 94c9b6b..1ef9f31 100644 --- a/nugget/include/app_nugget.h +++ b/nugget/include/app_nugget.h @@ -375,8 +375,10 @@ enum nugget_sjtag_avb_boot_lock_result { * (FS_MAX_FILE_SIZE - sizeof(struct nugget_app_data)) bytes. */ struct nugget_app_storage { - uint32_t flags; /* TBD, use zero for now */ - uint8_t data[0]; /* Zero or more bytes */ + uint32_t flags; /* TBD, use zero for now */ +#ifndef __cplusplus + uint8_t data[]; /* Zero or more bytes */ +#endif } __packed; #define NUGGET_PARAM_STORAGE_WRITE 0x0014 |