Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix anon-struct usage that's a warning/error -Wnon-c-typedef-for-linkage #137

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cachelib/compact_cache/CCacheDescriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ template <unsigned MaxSize>
struct VariableSizedValueDescriptor {
constexpr static bool kFixedSize = false;

using Value = struct {
struct Value {
char data[0];
// Data is here.
} __attribute__((__packed__));
Expand Down
4 changes: 2 additions & 2 deletions cachelib/compact_cache/CCacheFixedLruBucket.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ struct FixedLruBucket {

/** Type of the data stored in a bucket entry.
* This contains the key and the value (if any). */
using Entry = struct {
struct Entry {
Key key;
/* Expands to NoValue (size 0) if this cache does not store values */
Value val;
} __attribute__((__packed__));

/** Type of a bucket.
* Empty entry slots must be zeroed out to avoid spurious matches! */
using Bucket = struct {
struct Bucket {
Entry entries[kEntriesPerBucket];
} __attribute__((__packed__));

Expand Down
6 changes: 3 additions & 3 deletions cachelib/compact_cache/CCacheVariableLruBucket.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ struct VariableLruBucket {
constexpr static size_t kMaxEntries = std::numeric_limits<EntryNum>::max();

/** An entry header. */
using EntryHdr = struct {
struct EntryHdr {
Key key;
/* Size in bytes of the corresponding EntryData's data field. */
EntryDataSize dataSize;
Expand All @@ -140,7 +140,7 @@ struct VariableLruBucket {
EntryDataOffset dataOffset;
} __attribute__((__packed__));

using EntryData = struct {
struct EntryData {
/* Index of the corresponding EntryHdr header in the 'Entry
* Headers' section. This is a value between 0 and the number of entries
* in the bucket. */
Expand All @@ -155,7 +155,7 @@ struct VariableLruBucket {
constexpr static size_t kBucketDataSize =
kMaxValueSize + sizeof(EntryHdr) + sizeof(EntryData);

using Bucket = struct {
struct Bucket {
/* Number of entries in the bucket. */
EntryNum numEntries;
/* Size of the "Data" section.
Expand Down