Skip to content

Commit

Permalink
fix anon-struct usage that's a warning/error -Wnon-c-typedef-for-link…
Browse files Browse the repository at this point in the history
…age (facebook#137)

Summary:
Pull Request resolved: facebook#137

Fix
  error: anonymous non-C-compatible type given name for linkage purposes by alias declaration; add a tag name here [-Werror,-Wnon-c-typedef-for-linkage]

Reviewed By: philippv

Differential Revision: D36043476

fbshipit-source-id: df3fa684c8655184dd8f87045542cd7f5704a65e
  • Loading branch information
luciang authored and igchor committed May 16, 2022
1 parent fff3c3c commit a0995a5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
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

0 comments on commit a0995a5

Please sign in to comment.