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 (pytorch#76610)

Summary:
Pull Request resolved: pytorch#76610

X-link: facebookincubator/gloo#328

X-link: facebookarchive/fbzmq#38

X-link: facebook/CacheLib#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]

Test Plan:
```name=before
buck-out/v2/gen/fbcode/d839c731f5505c62/datasec/messaging/auth/utils/__MessagingAuthUtils__/headers/datasec/messaging/auth/utils/MessagingAuthLogger.h:83:25: 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]
  using LogInfo = struct {
```

CI

Reviewed By: philippv

Differential Revision: D36043476

fbshipit-source-id: 679f3b5efd0d233f6cb472e9cba54747ffd49c4e
  • Loading branch information
luciang authored and facebook-github-bot committed Apr 30, 2022
1 parent 1f1d0b3 commit 112512c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion caffe2/contrib/shm_mutex/shm_mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ShmProcessMutexCheck {
template <class Derived>
struct shm_traits;

using ShmBaseHeader = struct {
struct ShmBaseHeader {
std::atomic<bool> isInitialized;
std::atomic<int> countMapped;
std::atomic<pid_t> owner;
Expand Down
4 changes: 2 additions & 2 deletions caffe2/image/image_input_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ImageInputOp final : public PrefetchOperator<Context> {
bool CopyPrefetched() override;

private:
using BoundingBox = struct {
struct BoundingBox {
bool valid;
int ymin;
int xmin;
Expand All @@ -73,7 +73,7 @@ class ImageInputOp final : public PrefetchOperator<Context> {
// Structure to store per-image information
// This can be modified by the DecodeAnd* so needs
// to be privatized per launch.
using PerImageArg = struct { BoundingBox bounding_params; };
struct PerImageArg { BoundingBox bounding_params; };

bool GetImageAndLabelAndInfoFromDBValue(
const string& value,
Expand Down

0 comments on commit 112512c

Please sign in to comment.