Details
-
Bug
-
Resolution: Duplicate
-
Minor
-
None
-
None
-
None
-
3
-
11962
Description
GCC supports offsetof() on non-constant expressions but in general this is compiler-dependent behavior. In particular, the IBM XLC does not support it. Since luster_user.h may be used by user applications, we should try to make the header as portable as possible.
This is the function:
/** Compute the current length of the provided hsm_user_request. */ static inline int hur_len(struct hsm_user_request *hur) { return offsetof(struct hsm_user_request, hur_user_item[hur->hur_request.hr_itemcount]) + hur->hur_request.hr_data_len; }
Building the header with the IBM compilers produces this error:
"/usr/local/tools/liblustre/include/lustre/lustre_user.h", line 1006.55: 1506-307 (S) Array index must be a constant expression in the offsetof macro.