From bf3dcb9599b3f3ef3d1aa200100a14b92ebf1e77 Mon Sep 17 00:00:00 2001 From: Lucian Grijincu Date: Mon, 2 May 2022 18:14:27 +0000 Subject: [PATCH] fix anon-struct usage that's a warning/error -Wnon-c-typedef-for-linkage (#137) Summary: 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 Pull Request resolved: https://github.com/pytorch/pytorch/pull/76610 Approved by: https://github.com/philippv, https://github.com/osalpekar --- 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 f2dc4ff97e8b..8f0293caf5f3 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 5d72898bfc69..d1c27e0845a8 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,