From: Christopher J. Morrone Date: Wed, 30 Apr 2014 21:20:27 +0000 (-0700) Subject: LU-4987 lustre: Remove static declaration in anonymous union X-Git-Tag: 2.5.59~13 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=7accfdfaf71390e189f0148fedf2501cb8c63268;p=fs%2Flustre-release.git LU-4987 lustre: Remove static declaration in anonymous union It is not permitted in C++ to have a static declaration inside of an anonymous union. Before "LUSTRE_ANONYMOUS_UNION_NAME" was added to the code in commit b40f6327bb19b6, the g++ compiler most likely complained with an error like this: error: ‘struct ost_id::::ostid’ invalid; an anonymous union can only have non-static data members [-fpermissive] The fix from b40f6327bb19b6 conditionally eliminated the anonymous union when a C++ compiler is being used. That means that the API varies depending on your choice of compiler, which is not at all desirable. The better fix is to address the static data member that the error complained about. This patch changes the code to use an unnamed struct in place of "struct ostid" inside of the anonymous union. That name declaration was completely unnecessary anyway, since it was not used anywhere else. Change-Id: I59f8341f5f9833d8a144cf2feaa178cb76e643dc Signed-off-by: Christopher J. Morrone Reviewed-on: http://review.whamcloud.com/10176 Reviewed-by: Robert Read Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo --- diff --git a/lustre/include/lustre/lustre_user.h b/lustre/include/lustre/lustre_user.h index 2e97ab5..412b717 100644 --- a/lustre/include/lustre/lustre_user.h +++ b/lustre/include/lustre/lustre_user.h @@ -61,12 +61,6 @@ #error Unsupported operating system. #endif -#ifdef __cplusplus -#define LUSTRE_ANONYMOUS_UNION_NAME u -#else -#define LUSTRE_ANONYMOUS_UNION_NAME -#endif - /* for statfs() */ #define LL_SUPER_MAGIC 0x0BD00BD0 @@ -194,12 +188,12 @@ struct lustre_mdt_attrs { */ struct ost_id { union { - struct ostid { + struct { __u64 oi_id; __u64 oi_seq; } oi; struct lu_fid oi_fid; - } LUSTRE_ANONYMOUS_UNION_NAME; + }; }; #define DOSTID LPX64":"LPU64