From 112512ccbe4ba71d2f401090166621de6b8cac30 Mon Sep 17 00:00:00 2001 From: Lucian Grijincu Date: Sat, 30 Apr 2022 00:20:19 -0700 Subject: [PATCH] fix anon-struct usage that's a warning/error -Wnon-c-typedef-for-linkage (#76610) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/76610 X-link: https://github.com/facebookincubator/gloo/pull/328 X-link: https://github.com/facebook/fbzmq/pull/38 X-link: https://github.com/facebook/CacheLib/pull/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 --- caffe2/contrib/shm_mutex/shm_mutex.h | 2 +- caffe2/image/image_input_op.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/caffe2/contrib/shm_mutex/shm_mutex.h b/caffe2/contrib/shm_mutex/shm_mutex.h index f2dc4ff97e8ba..8f0293caf5f39 100644 --- a/caffe2/contrib/shm_mutex/shm_mutex.h +++ b/caffe2/contrib/shm_mutex/shm_mutex.h @@ -58,7 +58,7 @@ class ShmProcessMutexCheck { template struct shm_traits; -using ShmBaseHeader = struct { +struct ShmBaseHeader { std::atomic isInitialized; std::atomic countMapped; std::atomic owner; diff --git a/caffe2/image/image_input_op.h b/caffe2/image/image_input_op.h index 5d72898bfc694..d1c27e0845a84 100644 --- a/caffe2/image/image_input_op.h +++ b/caffe2/image/image_input_op.h @@ -62,7 +62,7 @@ class ImageInputOp final : public PrefetchOperator { bool CopyPrefetched() override; private: - using BoundingBox = struct { + struct BoundingBox { bool valid; int ymin; int xmin; @@ -73,7 +73,7 @@ class ImageInputOp final : public PrefetchOperator { // 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,