Commit cce8f294 authored by Tiancong Wang's avatar Tiancong Wang Committed by Commit Bot

cbor: Fix typedef struct naming for new CrOS Clang updates

New Clang update reports new warnings when C++ code provides
anonymous typedef structs. The suggested solution is to either add
a tag to the name or use C++-style struct.
This patch fixes the warnings for the next toolchain update.

Bug: 1068297
Test: Tested on Chrome OS
Change-Id: I6863bc10d9094497b0d634ddee04891df8372906
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144413Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Tiancong Wang <tcwang@google.com>
Cr-Commit-Position: refs/heads/master@{#758025}
parent 84946b97
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
namespace cbor { namespace cbor {
TEST(CBORWriterTest, TestWriteUint) { TEST(CBORWriterTest, TestWriteUint) {
typedef struct { struct UintTestCase {
const int64_t value; const int64_t value;
const base::StringPiece cbor; const base::StringPiece cbor;
} UintTestCase; };
static const UintTestCase kUintTestCases[] = { static const UintTestCase kUintTestCases[] = {
// Reminder: must specify length when creating string pieces // Reminder: must specify length when creating string pieces
...@@ -76,10 +76,10 @@ TEST(CBORWriterTest, TestWriteNegativeInteger) { ...@@ -76,10 +76,10 @@ TEST(CBORWriterTest, TestWriteNegativeInteger) {
} }
TEST(CBORWriterTest, TestWriteBytes) { TEST(CBORWriterTest, TestWriteBytes) {
typedef struct { struct BytesTestCase {
const std::vector<uint8_t> bytes; const std::vector<uint8_t> bytes;
const base::StringPiece cbor; const base::StringPiece cbor;
} BytesTestCase; };
static const BytesTestCase kBytesTestCases[] = { static const BytesTestCase kBytesTestCases[] = {
{{}, base::StringPiece("\x40")}, {{}, base::StringPiece("\x40")},
...@@ -94,10 +94,10 @@ TEST(CBORWriterTest, TestWriteBytes) { ...@@ -94,10 +94,10 @@ TEST(CBORWriterTest, TestWriteBytes) {
} }
TEST(CBORWriterTest, TestWriteString) { TEST(CBORWriterTest, TestWriteString) {
typedef struct { struct StringTestCase {
const std::string string; const std::string string;
const base::StringPiece cbor; const base::StringPiece cbor;
} StringTestCase; };
static const StringTestCase kStringTestCases[] = { static const StringTestCase kStringTestCases[] = {
{"", base::StringPiece("\x60")}, {"", base::StringPiece("\x60")},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment