Whamcloud - gitweb
LU-4987 lustre: Remove static declaration in anonymous union 76/10176/2
authorChristopher J. Morrone <morrone2@llnl.gov>
Wed, 30 Apr 2014 21:20:27 +0000 (14:20 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 13 May 2014 14:44:03 +0000 (14:44 +0000)
commit7accfdfaf71390e189f0148fedf2501cb8c63268
tree17a868ba60853472d42cf4342904696acbefe954
parent1504473051df3d20e824f1064ee134501f3856e8
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::<anonymous union>::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 <morrone2@llnl.gov>
Reviewed-on: http://review.whamcloud.com/10176
Reviewed-by: Robert Read <robert.read@intel.com>
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/include/lustre/lustre_user.h