Changeset 9367 in vbox for trunk/include/iprt/assert.h
- Timestamp:
- Jun 3, 2008 10:26:52 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/assert.h
r8615 r9367 185 185 AssertCompile(!(sizeof(type) & ((align) - 1))) 186 186 187 /** @def AssertCompileMemberSize 188 * Asserts a member offset alignment at compile. 189 * @param type The type. 190 * @param member The member. 191 * @param size The member size to assert. 192 */ 193 #define AssertCompileMemberSize(type, member, size) \ 194 AssertCompile(RT_SIZEOFMEMB(type, member) == (size)) 195 196 /** @def AssertCompileMemberSizeAlignment 197 * Asserts a member size alignment at compile. 198 * @param type The type. 199 * @param member The member. 200 * @param align The member size alignment to assert. 201 */ 202 #define AssertCompileMemberSizeAlignment(type, member, align) \ 203 AssertCompile(!(RT_SIZEOFMEMB(type, member) & ((align) - 1))) 204 187 205 /** @def AssertCompileMemberAlignment 188 206 * Asserts a member offset alignment at compile. … … 204 222 #endif 205 223 206 207 /** @def AssertCompileMemberSize 208 * Asserts a member offset alignment at compile. 224 /** @def AssertCompileMemberOffset 225 * Asserts a offset of a structure member at compile. 209 226 * @param type The type. 210 227 * @param member The member. 211 * @param size The member size to assert. 212 */ 213 #define AssertCompileMemberSize(type, member, size) \ 214 AssertCompile(RT_SIZEOFMEMB(type, member) == (size)) 215 216 /** @def AssertCompileMemberSizeAlignment 217 * Asserts a member size alignment at compile. 218 * @param type The type. 219 * @param member The member. 220 * @param align The member size alignment to assert. 221 */ 222 #define AssertCompileMemberSizeAlignment(type, member, align) \ 223 AssertCompile(!(RT_SIZEOFMEMB(type, member) & ((align) - 1))) 228 * @param off The expected offset. 229 */ 230 #if defined(__GNUC__) && defined(__cplusplus) 231 # if __GNUC__ >= 4 232 # define AssertCompileMemberOffset(type, member, off) \ 233 AssertCompile(!(__builtin_offsetof(type, member) == (off))) 234 # else 235 # define AssertCompileMemberOffset(type, member, off) \ 236 AssertCompile(!(RT_OFFSETOF(type, member) == (off))) 237 # endif 238 #else 239 # define AssertCompileMemberOffset(type, member, off) \ 240 AssertCompile(!(RT_OFFSETOF(type, member) & (off))) 241 #endif 224 242 225 243
Note:
See TracChangeset
for help on using the changeset viewer.