VirtualBox

Changeset 66098 in vbox


Ignore:
Timestamp:
Mar 14, 2017 7:04:01 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
113977
Message:

iprt/cdefs.h: Added RT_FLEXIBLE_ARRAY_IN_UNION and RT_FLEXIBLE_ARRAY_IN_NESTED_UNION.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/cdefs.h

    r66089 r66098  
    22892289 *
    22902290 * @note    Use RT_UOFFSETOF() to calculate the structure size.
     2291 *
    22912292 * @note    Never to a sizeof() on the structure or member!
     2293 *
    22922294 * @note    The member must be the last one.
    2293  * @note    GCC does not permit using this in a union.
     2295 *
     2296 * @note    GCC does not permit using this in a union.  So, for unions you must
     2297 *          use RT_FLEXIBLE_ARRAY_IN_UNION instead.
     2298 *
    22942299 * @note    GCC does not permit using this in nested structures, where as MSC
    22952300 *          does.  So, use RT_FLEXIBLE_ARRAY_NESTED for that.
    22962301 *
    2297  * @sa      RT_FLEXIBLE_ARRAY_NESTED
    2298  */
    2299 #if RT_MSC_PREREQ(RT_MSC_VER_VS2010) /** @todo Probably much much earlier. */ \
     2302 * @sa      RT_FLEXIBLE_ARRAY_NESTED, RT_FLEXIBLE_ARRAY_IN_UNION
     2303 */
     2304#if RT_MSC_PREREQ(RT_MSC_VER_VS2005) /** @todo Probably much much earlier. */ \
    23002305 || (defined(__cplusplus) && RT_GNUC_PREREQ(6, 1)) \
    23012306 || defined(__WATCOMC__) /* openwatcom 1.9 supports it, we don't care about older atm. */
     
    23122317#else
    23132318# define RT_FLEXIBLE_ARRAY                      1
     2319#endif
     2320
     2321/** @def RT_FLEXIBLE_ARRAY_NESTED
     2322 * Variant of RT_FLEXIBLE_ARRAY for use in structures that are nested.
     2323 *
     2324 * GCC only allow the use of flexible array member in the top structure, whereas
     2325 * MSC is less strict and let you do struct { struct { char szName[]; } s; };
     2326 *
     2327 * @note    See notes for RT_FLEXIBLE_ARRAY.
     2328 *
     2329 * @note    GCC does not permit using this in a union.  So, for unions you must
     2330 *          use RT_FLEXIBLE_ARRAY_IN_NESTED_UNION instead.
     2331 *
     2332 * @sa      RT_FLEXIBLE_ARRAY, RT_FLEXIBLE_ARRAY_IN_NESTED_UNION
     2333 */
     2334#ifdef _MSC_VER
     2335# define RT_FLEXIBLE_ARRAY_NESTED               RT_FLEXIBLE_ARRAY
     2336#else
     2337# define RT_FLEXIBLE_ARRAY_NESTED               1
     2338#endif
     2339
     2340/** @def RT_FLEXIBLE_ARRAY_IN_UNION
     2341 * The union version of RT_FLEXIBLE_ARRAY.
     2342 *
     2343 * @remarks GCC does not support flexible array members in unions, 6.1.x
     2344 *          actively checks for this.  Visual C++ 2010 seems happy with it.
     2345 *
     2346 * @note    See notes for RT_FLEXIBLE_ARRAY.
     2347 *
     2348 * @sa      RT_FLEXIBLE_ARRAY, RT_FLEXIBLE_ARRAY_IN_NESTED_UNION
     2349 */
     2350#ifdef _MSC_VER
     2351# define RT_FLEXIBLE_ARRAY_IN_UNION             RT_FLEXIBLE_ARRAY
     2352#else
     2353# define RT_FLEXIBLE_ARRAY_IN_UNION             1
     2354#endif
     2355
     2356/** @def RT_FLEXIBLE_ARRAY_IN_NESTED_UNION
     2357 * The union version of RT_FLEXIBLE_ARRAY_NESTED.
     2358 *
     2359 * @note    See notes for RT_FLEXIBLE_ARRAY.
     2360 *
     2361 * @sa      RT_FLEXIBLE_ARRAY, RT_FLEXIBLE_ARRAY_IN_NESTED_UNION
     2362 */
     2363#ifdef _MSC_VER
     2364# define RT_FLEXIBLE_ARRAY_IN_NESTED_UNION      RT_FLEXIBLE_ARRAY_NESTED
     2365#else
     2366# define RT_FLEXIBLE_ARRAY_IN_NESTED_UNION      1
    23142367#endif
    23152368
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette