VirtualBox

Changeset 66064 in vbox


Ignore:
Timestamp:
Mar 13, 2017 4:25:47 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
113933
Message:

iprt/cdefs.h: Adding a RT_FLEXIBLE_ARRAY macro.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Config.kmk

    r66016 r66064  
    28102810#      -wd4242: '=' : conversion from 'uint32_t' to 'uint8_t', possible loss of data
    28112811#      -wd4244: 'conversion' conversion from 'type1' to 'type2', possible loss of data
     2812#      -wd4200: nonstandard extension used : zero-sized array in struct/union
     2813#               Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array
    28122814VBOX_VCC_WARN_ALL ?= -W4 -Wall -wd4065 -wd4996 -wd4127 -wd4706 -wd4201 -wd4214 -wd4510 -wd4512 -wd4610 \
    28132815        -wd4514 -wd4820 -wd4365 -wd4987 -wd4710 -wd4061 -wd4986 -wd4191 -wd4574 -wd4917 -wd4711 -wd4611 -wd4571 -wd4324 -wd4505 \
    2814         -wd4263 -wd4264 -wd4738
     2816        -wd4263 -wd4264 -wd4738 -wd4200
    28152817#ifndef VBOX_WITH_MASOCHISTIC_WARNINGS
    28162818# VBOX_VCC_WARN_ALL +=
  • trunk/include/iprt/cdefs.h

    r65873 r66064  
    22842284#define RT_ELEMENTS(aArray)                     ( sizeof(aArray) / sizeof((aArray)[0]) )
    22852285
     2286/** @def RT_FLEXIBLE_ARRAY
     2287 * What to up inside the square brackets when declaring a structure member
     2288 * with a flexible size.
     2289 *
     2290 * @note    Use RT_UOFFSETOF() to calculate the structure size.
     2291 * @note    Never to a sizeof() on the structure or member!
     2292 * @note    The member must be the last one.
     2293 */
     2294#if RT_MSC_PREREQ(RT_MSC_VER_VS2010) /** @todo Probably much much earlier. */ \
     2295 || (defined(__cplusplus) && RT_GNUC_PREREQ(4, 1)) /** @todo Figure out when applies to the G++ compiler and -std=?? effects. */ \
     2296 || defined(__WATCOMC__) /* openwatcom 1.9 supports it, we don't care about older atm. */
     2297# define RT_FLEXIBLE_ARRAY
     2298# if defined(__cplusplus) && defined(_MSC_VER)
     2299#  pragma warning(disable:4200) /* -wd4200 does not work with VS2010 */
     2300# endif
     2301#elif defined(__STDC_VERSION__)
     2302# if __STDC_VERSION__ >= 1999901L
     2303#  define RT_FLEXIBLE_ARRAY
     2304# else
     2305#  define RT_FLEXIBLE_ARRAY                     1
     2306# endif
     2307#else
     2308# define RT_FLEXIBLE_ARRAY                      1
     2309#endif
     2310
    22862311/**
    22872312 * Checks if the value is a power of two.
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