diff options
author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2020-05-25 15:09:24 +0000 |
---|---|---|
committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2020-05-25 15:09:24 +0000 |
commit | f815f794ebdd224e3dcffcde6fb122537ab0626d (patch) | |
tree | 7a61f2a4145ea727ffe5fcf9d8e16b4c410419e6 | |
parent | af56b5e266c3995a9d9ca5225c8128395059c3b7 (diff) | |
download | VirtualBox-svn-f815f794ebdd224e3dcffcde6fb122537ab0626d.tar.gz |
iprt/cdefs.h,*: Introducing RT_FLEXIBLE_ARRAY_EXTENSION as a g++ hack that allows us to use RT_FLEXIBLE_ARRAY without the compiler going all pendantic on us. Only tested with 10.1.0. bugref:9746
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@84509 cfe28804-0f27-0410-a406-dd0f0b0b656f
30 files changed, 68 insertions, 3 deletions
diff --git a/include/VBox/VBoxGuestLibSharedFoldersInline.h b/include/VBox/VBoxGuestLibSharedFoldersInline.h index fd467eb5823..e17ad886854 100644 --- a/include/VBox/VBoxGuestLibSharedFoldersInline.h +++ b/include/VBox/VBoxGuestLibSharedFoldersInline.h @@ -969,6 +969,7 @@ typedef struct VBOXSFREADEMBEDDEDREQ VBGLIOCIDCHGCMFASTCALL Hdr; VMMDevHGCMCall Call; VBoxSFParmRead Parms; + RT_FLEXIBLE_ARRAY_EXTENSION uint8_t abData[RT_FLEXIBLE_ARRAY]; } VBOXSFREADEMBEDDEDREQ; @@ -1116,6 +1117,7 @@ typedef struct VBOXSFWRITEEMBEDDEDREQ VBGLIOCIDCHGCMFASTCALL Hdr; VMMDevHGCMCall Call; VBoxSFParmWrite Parms; + RT_FLEXIBLE_ARRAY_EXTENSION uint8_t abData[RT_FLEXIBLE_ARRAY]; } VBOXSFWRITEEMBEDDEDREQ; diff --git a/include/VBox/vmm/pdmpcidev.h b/include/VBox/vmm/pdmpcidev.h index 89509485948..7d92463de44 100644 --- a/include/VBox/vmm/pdmpcidev.h +++ b/include/VBox/vmm/pdmpcidev.h @@ -243,6 +243,7 @@ typedef struct PDMPCIDEV * followed by a MSI-X state area. */ uint8_t abConfig[4096]; /** The MSI-X state data. Optional. */ + RT_FLEXIBLE_ARRAY_EXTENSION uint8_t abMsixState[RT_FLEXIBLE_ARRAY]; } PDMPCIDEV; #ifdef PDMPCIDEVINT_DECLARED diff --git a/include/iprt/cdefs.h b/include/iprt/cdefs.h index 18ccaa9b771..0ad251e6100 100644 --- a/include/iprt/cdefs.h +++ b/include/iprt/cdefs.h @@ -2543,6 +2543,9 @@ * What to up inside the square brackets when declaring a structure member * with a flexible size. * + * @note RT_FLEXIBLE_ARRAY_EXTENSION must always preceed the type, unless + * it's C-only code. + * * @note Use RT_UOFFSETOF() to calculate the structure size. * * @note Never to a sizeof() on the structure or member! @@ -2558,7 +2561,9 @@ * @sa RT_FLEXIBLE_ARRAY_NESTED, RT_FLEXIBLE_ARRAY_IN_UNION */ #if RT_MSC_PREREQ(RT_MSC_VER_VS2005) /** @todo Probably much much earlier. */ \ - || (defined(__cplusplus) && RT_GNUC_PREREQ(6, 1) && !RT_GNUC_PREREQ(7, 0)) /* gcc-7 warns again */\ + || (defined(__cplusplus) && ( RT_GNUC_PREREQ(6, 1) \ + && ( !RT_GNUC_PREREQ(7, 0) /* gcc-7 warns again */ \ + || RT_GNUC_PREREQ(10, 0) /* gcc-10 works with __extension__, the ones in between needs testing */ ))) \ || defined(__WATCOMC__) /* openwatcom 1.9 supports it, we don't care about older atm. */ \ || RT_CLANG_PREREQ_EX(3, 4, 0) /* Only tested clang v3.4, support is probably older. */ # define RT_FLEXIBLE_ARRAY @@ -2575,6 +2580,16 @@ # define RT_FLEXIBLE_ARRAY 1 #endif +/** @def RT_FLEXIBLE_ARRAY_EXTENSION + * A trick to make GNU C++ quietly accept flexible arrays in C++ code when + * pedantic warnings are enabled. Put this on the line before the flexible + * array. */ +#if (RT_GNUC_PREREQ(10, 0) && defined(__cplusplus)) || defined(DOXGYEN_RUNNING) +# define RT_FLEXIBLE_ARRAY_EXTENSION RT_GCC_EXTENSION +#else +# define RT_FLEXIBLE_ARRAY_EXTENSION +#endif + /** @def RT_FLEXIBLE_ARRAY_NESTED * Variant of RT_FLEXIBLE_ARRAY for use in structures that are nested. * diff --git a/include/iprt/crypto/applecodesign.h b/include/iprt/crypto/applecodesign.h index 8ce5e59f3b3..12d25196a77 100644 --- a/include/iprt/crypto/applecodesign.h +++ b/include/iprt/crypto/applecodesign.h @@ -147,6 +147,7 @@ typedef struct RTCRAPLCSSUPERBLOB /** Number of slots. Big endian. */ uint32_t cSlots; /** Slots. */ + RT_FLEXIBLE_ARRAY_EXTENSION RTCRAPLCSBLOBSLOT aSlots[RT_FLEXIBLE_ARRAY]; } RTCRAPLCSSUPERBLOB; AssertCompileMemberOffset(RTCRAPLCSSUPERBLOB, aSlots, 12); diff --git a/include/iprt/crypto/pem.h b/include/iprt/crypto/pem.h index cae526566e1..23272ca9c18 100644 --- a/include/iprt/crypto/pem.h +++ b/include/iprt/crypto/pem.h @@ -89,6 +89,7 @@ typedef struct RTCRPEMFIELD /** The field name length. */ size_t cchName; /** The field name. */ + RT_FLEXIBLE_ARRAY_EXTENSION char szName[RT_FLEXIBLE_ARRAY]; } RTCRPEMFIELD; /** Pointer to a PEM field. */ diff --git a/include/iprt/formats/iso9660.h b/include/iprt/formats/iso9660.h index c252b544c13..f57e2a545b2 100644 --- a/include/iprt/formats/iso9660.h +++ b/include/iprt/formats/iso9660.h @@ -238,6 +238,7 @@ typedef struct ISO9660PATHREC * @note Endianess depends on table. */ uint16_t idParentRec; /** 0x08: Directory identifier (d-characters or d1-characters). */ + RT_FLEXIBLE_ARRAY_EXTENSION char achDirId[RT_FLEXIBLE_ARRAY]; /* There will be a zero padding byte following if the directory identifier length is odd. */ } ISO9660PATHREC; @@ -290,6 +291,7 @@ typedef struct ISO9660EXATTRREC /** 0x0f6: Length of the application use field. */ ISO9660U16 cbAppUse; /** 0x0fa: Variable sized application use field. */ + RT_FLEXIBLE_ARRAY_EXTENSION uint8_t abAppUse[RT_FLEXIBLE_ARRAY]; /* This is followed by escape sequences with length given by cbEscapeSequnces. */ } ISO9660EXATTRREC; diff --git a/include/iprt/formats/mach-o.h b/include/iprt/formats/mach-o.h index 67e69c5b640..7850349b04f 100644 --- a/include/iprt/formats/mach-o.h +++ b/include/iprt/formats/mach-o.h @@ -631,6 +631,7 @@ typedef struct build_version_command uint32_t minos; /**< Minimum OS version: 31..16=major, 15..8=minor, 7..0=patch */ uint32_t sdk; /**< SDK version: 31..16=major, 15..8=minor, 7..0=patch */ uint32_t ntools; /**< Number of build_tool_version entries following in aTools. */ + RT_FLEXIBLE_ARRAY_EXTENSION build_tool_version_t aTools[RT_FLEXIBLE_ARRAY]; } build_version_command_t; AssertCompileMemberOffset(build_version_command_t, aTools, 24); diff --git a/include/iprt/formats/ntfs.h b/include/iprt/formats/ntfs.h index bbf124de541..f4eaace5b18 100644 --- a/include/iprt/formats/ntfs.h +++ b/include/iprt/formats/ntfs.h @@ -380,6 +380,7 @@ typedef struct NTFSATLISTENTRY /** 0x18: Attribute instance number. Unique within the MFT record. */ uint16_t idAttrib; /** 0x1a: Maybe where the attribute name starts. */ + RT_FLEXIBLE_ARRAY_EXTENSION RTUTF16 wszName[RT_FLEXIBLE_ARRAY]; } NTFSATLISTENTRY; AssertCompileMemberOffset(NTFSATLISTENTRY, idAttrib, 0x18); @@ -498,6 +499,7 @@ typedef struct NTFSATFILENAME /** 0x41: Filename type (NTFS_FILENAME_T_XXX). */ uint8_t fFilenameType; /** 0x42: The filename. */ + RT_FLEXIBLE_ARRAY_EXTENSION RTUTF16 wszFilename[RT_FLEXIBLE_ARRAY]; } NTFSATFILENAME; AssertCompileMemberOffset(NTFSATFILENAME, cbData, 0x30); diff --git a/include/iprt/formats/pecoff.h b/include/iprt/formats/pecoff.h index 5499709b2cb..9e07a7a0baa 100644 --- a/include/iprt/formats/pecoff.h +++ b/include/iprt/formats/pecoff.h @@ -720,7 +720,8 @@ typedef struct IMAGE_UNWIND_INFO /** Scaled frame register offset. */ RT_GCC_EXTENSION uint8_t FrameOffset : 4; /** Unwind opcodes. */ - IMAGE_UNWIND_CODE aOpcodes[RT_FLEXIBLE_ARRAY]; + RT_FLEXIBLE_ARRAY_EXTENSION + IMAGE_UNWIND_CODE aOpcodes[RT_FLEXIBLE_ARRAY]; } IMAGE_UNWIND_INFO; AssertCompileMemberOffset(IMAGE_UNWIND_INFO, aOpcodes, 4); typedef IMAGE_UNWIND_INFO *PIMAGE_UNWIND_INFO; diff --git a/include/iprt/formats/udf.h b/include/iprt/formats/udf.h index b307120d226..bc056a3cc3f 100644 --- a/include/iprt/formats/udf.h +++ b/include/iprt/formats/udf.h @@ -791,6 +791,7 @@ typedef struct UDFLOGICALVOLUMEDESC UDFEXTENTAD IntegritySeqExtent; /** 0x1b8: Partition maps (length given by @a cbMapTable), data format is * defined by UDFPARTMAPHDR, UDFPARTMAPTYPE1 and UDFPARTMAPTYPE2. */ + RT_FLEXIBLE_ARRAY_EXTENSION uint8_t abPartitionMaps[RT_FLEXIBLE_ARRAY]; } UDFLOGICALVOLUMEDESC; AssertCompileMemberOffset(UDFLOGICALVOLUMEDESC, abPartitionMaps, 0x1b8); @@ -924,6 +925,7 @@ typedef struct UDFUNALLOCATEDSPACEDESC /** 0x14: Number of allocation descriptors in the array below. */ uint32_t cAllocationDescriptors; /** 0x18: Allocation descriptors (variable length). */ + RT_FLEXIBLE_ARRAY_EXTENSION UDFEXTENTAD aAllocationDescriptors[RT_FLEXIBLE_ARRAY]; } UDFUNALLOCATEDSPACEDESC; AssertCompileMemberOffset(UDFUNALLOCATEDSPACEDESC, aAllocationDescriptors, 0x18); @@ -974,6 +976,7 @@ typedef struct UDFLOGICALVOLINTEGRITYDESC * Following these tables there are @a cbImplementationUse bytes of space for * the implementation to use. */ + RT_FLEXIBLE_ARRAY_EXTENSION uint32_t aTables[RT_FLEXIBLE_ARRAY]; } UDFLOGICALVOLINTEGRITYDESC; AssertCompileMemberOffset(UDFLOGICALVOLINTEGRITYDESC, cbImplementationUse, 0x2c); @@ -1074,6 +1077,7 @@ typedef struct UDFFILEIDDESC * implementation use field with length given by @a cbImplementationUse. * After that is a d-string field with the name of the file, length * specified by @a cbName. */ + RT_FLEXIBLE_ARRAY_EXTENSION uint8_t abImplementationUse[RT_FLEXIBLE_ARRAY]; } UDFFILEIDDESC; AssertCompileMemberOffset(UDFFILEIDDESC, fFlags, 0x12); @@ -1357,6 +1361,7 @@ typedef struct UDFFILEENTRY uint32_t cbAllocDescs; /** 0xb0: Two variable sized fields. First @a cbExtAttribs bytes of extended * attributes, then @a cbAllocDescs bytes of allocation descriptors. */ + RT_FLEXIBLE_ARRAY_EXTENSION uint8_t abExtAttribs[RT_FLEXIBLE_ARRAY]; } UDFFILEENTRY; AssertCompileMemberOffset(UDFFILEENTRY, abExtAttribs, 0xb0); @@ -1970,6 +1975,7 @@ typedef struct UDFSPACEBITMAPDESC /** 0x14: The bitmap size in bytes. */ uint32_t cbBitmap; /** 0x18: The bitmap. */ + RT_FLEXIBLE_ARRAY_EXTENSION uint8_t abBitmap[RT_FLEXIBLE_ARRAY]; } UDFSPACEBITMAPDESC; AssertCompileMemberOffset(UDFSPACEBITMAPDESC, abBitmap, 0x18); @@ -1999,6 +2005,7 @@ typedef struct UDFPARTITIONINTEGRITYDESC /** 0x0e0: Implementation identifier. */ UDFENTITYID idImplementation; /** 0x100: Implementation use data. */ + RT_FLEXIBLE_ARRAY_EXTENSION uint8_t abImplementationUse[RT_FLEXIBLE_ARRAY]; } UDFPARTITIONINTEGRITYDESC; AssertCompileMemberOffset(UDFPARTITIONINTEGRITYDESC, abImplementationUse, 0x100); @@ -2066,6 +2073,7 @@ typedef struct UDFEXFILEENTRY uint32_t cbAllocDescs; /** 0xd8: Two variable sized fields. First @a cbExtAttribs bytes of extended * attributes, then @a cbAllocDescs bytes of allocation descriptors. */ + RT_FLEXIBLE_ARRAY_EXTENSION uint8_t abExtAttribs[RT_FLEXIBLE_ARRAY]; } UDFEXFILEENTRY; AssertCompileMemberOffset(UDFEXFILEENTRY, abExtAttribs, 0xd8); diff --git a/include/iprt/nt/hyperv.h b/include/iprt/nt/hyperv.h index 649625ad8b4..830e4072a15 100644 --- a/include/iprt/nt/hyperv.h +++ b/include/iprt/nt/hyperv.h @@ -35,6 +35,7 @@ # include <iprt/assertcompile.h> #else # define RT_FLEXIBLE_ARRAY +# define RT_FLEXIBLE_ARRAY_EXTENSION # define AssertCompile(expr) # define AssertCompileSize(type, size) # define AssertCompileMemberOffset(type, member, off) @@ -497,6 +498,7 @@ typedef struct HV_MAP_GPA_FLAGS MapFlags; uint32_t u32ExplicitPadding; /* The repeating part: */ + RT_FLEXIBLE_ARRAY_EXTENSION HV_SPA_PAGE_NUMBER PageList[RT_FLEXIBLE_ARRAY]; } HV_INPUT_MAP_GPA_PAGES; AssertCompileMemberOffset(HV_INPUT_MAP_GPA_PAGES, PageList, 24); @@ -520,6 +522,7 @@ typedef struct HV_MAP_GPA_FLAGS MapFlags; uint32_t u32ExplicitPadding; /* The repeating part: */ + RT_FLEXIBLE_ARRAY_EXTENSION HV_GPA_MAPPING PageList[RT_FLEXIBLE_ARRAY]; } HV_INPUT_MAP_SPARSE_GPA_PAGES; AssertCompileMemberOffset(HV_INPUT_MAP_SPARSE_GPA_PAGES, PageList, 16); @@ -1233,6 +1236,7 @@ typedef struct /** Was this introduced after v2? Dunno what it it really is. */ uint32_t fFlags; /* The repeating part: */ + RT_FLEXIBLE_ARRAY_EXTENSION HV_REGISTER_NAME Names[RT_FLEXIBLE_ARRAY]; } HV_INPUT_GET_VP_REGISTERS; AssertCompileMemberOffset(HV_INPUT_GET_VP_REGISTERS, Names, 16); @@ -1267,6 +1271,7 @@ typedef struct HV_VP_INDEX VpIndex; uint32_t RsvdZ; /* The repeating part: */ + RT_FLEXIBLE_ARRAY_EXTENSION HV_REGISTER_ASSOC Elements[RT_FLEXIBLE_ARRAY]; } HV_INPUT_SET_VP_REGISTERS; AssertCompileMemberOffset(HV_INPUT_SET_VP_REGISTERS, Elements, 16); diff --git a/include/iprt/path.h b/include/iprt/path.h index 18840d90c5f..34ef2a505ba 100644 --- a/include/iprt/path.h +++ b/include/iprt/path.h @@ -740,6 +740,7 @@ typedef struct RTPATHPARSED * @note Don't try figure the end of the input path by adding up off and cch * of the last component. If RTPATH_PROP_DIR_SLASH is set, there may * be one or more trailing slashes that are unaccounted for! */ + RT_FLEXIBLE_ARRAY_EXTENSION struct { /** The offset of the component. */ @@ -832,6 +833,7 @@ typedef struct RTPATHSPLIT * present. */ const char *pszSuffix; /** Array of component strings (variable size). */ + RT_FLEXIBLE_ARRAY_EXTENSION char *apszComps[RT_FLEXIBLE_ARRAY]; } RTPATHSPLIT; /** Pointer to a split path buffer. */ diff --git a/src/VBox/Additions/os2/VBoxSF/VBoxSFInternal.h b/src/VBox/Additions/os2/VBoxSF/VBoxSFInternal.h index 9306d585476..d473e6dade3 100644 --- a/src/VBox/Additions/os2/VBoxSF/VBoxSFInternal.h +++ b/src/VBox/Additions/os2/VBoxSF/VBoxSFInternal.h @@ -86,6 +86,7 @@ typedef struct VBOXSFFOLDER /** The length of the folder name. */ uint8_t cchName; /** The shared folder name. If there is a tag it follows as a second string. */ + RT_FLEXIBLE_ARRAY_EXTENSION char szName[RT_FLEXIBLE_ARRAY]; } VBOXSFFOLDER; /** Pointer to a shared folder. */ diff --git a/src/VBox/Devices/VirtIO/Virtio_1_0.cpp b/src/VBox/Devices/VirtIO/Virtio_1_0.cpp index 42e219cb945..3b4e57cae15 100644 --- a/src/VBox/Devices/VirtIO/Virtio_1_0.cpp +++ b/src/VBox/Devices/VirtIO/Virtio_1_0.cpp @@ -95,6 +95,7 @@ typedef struct virtq_avail { uint16_t fFlags; /**< flags avail ring guest-to-host flags */ uint16_t uIdx; /**< idx Index of next free ring slot */ + RT_FLEXIBLE_ARRAY_EXTENSION uint16_t auRing[RT_FLEXIBLE_ARRAY]; /**< ring Ring: avail drv to dev bufs */ /* uint16_t uUsedEventIdx; - used_event (if VIRTQ_USED_F_EVENT_IDX) */ } VIRTQ_AVAIL_T, *PVIRTQ_AVAIL_T; @@ -109,6 +110,7 @@ typedef struct virt_used { uint16_t fFlags; /**< flags used ring host-to-guest flags */ uint16_t uIdx; /**< idx Index of next ring slot */ + RT_FLEXIBLE_ARRAY_EXTENSION VIRTQ_USED_ELEM_T aRing[RT_FLEXIBLE_ARRAY]; /**< ring Ring: used dev to drv bufs */ /* uint16_t uAvailEventIdx; - avail_event if (VIRTQ_USED_F_EVENT_IDX) */ } VIRTQ_USED_T, *PVIRTQ_USED_T; diff --git a/src/VBox/Devices/testcase/tstDeviceInternal.h b/src/VBox/Devices/testcase/tstDeviceInternal.h index b1cc5193e74..53cf919744e 100644 --- a/src/VBox/Devices/testcase/tstDeviceInternal.h +++ b/src/VBox/Devices/testcase/tstDeviceInternal.h @@ -130,6 +130,7 @@ typedef struct TSTDEVMMHEAPALLOC /** Size of the allocation. */ size_t cbAlloc; /** Start of the real allocation. */ + RT_FLEXIBLE_ARRAY_EXTENSION uint8_t abAlloc[RT_FLEXIBLE_ARRAY]; } TSTDEVMMHEAPALLOC; /** Pointer to a MM Heap allocation. */ diff --git a/src/VBox/HostServices/GuestControl/VBoxGuestControlSvc.cpp b/src/VBox/HostServices/GuestControl/VBoxGuestControlSvc.cpp index 2187a085572..793c52f6c56 100644 --- a/src/VBox/HostServices/GuestControl/VBoxGuestControlSvc.cpp +++ b/src/VBox/HostServices/GuestControl/VBoxGuestControlSvc.cpp @@ -842,6 +842,7 @@ typedef struct GstCtrlPreparedSession /** The key size. */ uint32_t cbKey; /** The key bytes. */ + RT_FLEXIBLE_ARRAY_EXTENSION uint8_t abKey[RT_FLEXIBLE_ARRAY]; } GstCtrlPreparedSession; diff --git a/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h b/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h index 82737b7c3ce..fe0e23ac93c 100644 --- a/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h +++ b/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h @@ -56,6 +56,7 @@ typedef struct _SHCLCLIENTMSG /** Number of stored parameters in aParms. */ uint32_t cParms; /** HGCM parameters. */ + RT_FLEXIBLE_ARRAY_EXTENSION VBOXHGCMSVCPARM aParms[RT_FLEXIBLE_ARRAY]; } SHCLCLIENTMSG; /** Pointer to a queue message for the guest. */ diff --git a/src/VBox/Runtime/common/checksum/manifest2.cpp b/src/VBox/Runtime/common/checksum/manifest2.cpp index be3082b220b..ba0a8f1f4a2 100644 --- a/src/VBox/Runtime/common/checksum/manifest2.cpp +++ b/src/VBox/Runtime/common/checksum/manifest2.cpp @@ -64,6 +64,7 @@ typedef struct RTMANIFESTATTR /** Whether it was visited by the equals operation or not. */ bool fVisited; /** The normalized property name that StrCore::pszString points at. */ + RT_FLEXIBLE_ARRAY_EXTENSION char szName[RT_FLEXIBLE_ARRAY]; } RTMANIFESTATTR; /** Pointer to a manifest attribute. */ diff --git a/src/VBox/Runtime/common/dbg/dbgmodmapsym.cpp b/src/VBox/Runtime/common/dbg/dbgmodmapsym.cpp index 2847eb43516..e9f93f80bef 100644 --- a/src/VBox/Runtime/common/dbg/dbgmodmapsym.cpp +++ b/src/VBox/Runtime/common/dbg/dbgmodmapsym.cpp @@ -66,6 +66,7 @@ typedef struct MAPSYMHDR uint16_t off16SegDef; /**< 0x0c: Offset of the segment defintions divided by 16. */ uint8_t cchMaxSym; /**< 0x0e: Maximum symbol-name length. */ uint8_t cchModule; /**< 0x0f: Length of the module name. */ + RT_FLEXIBLE_ARRAY_EXTENSION char achModule[RT_FLEXIBLE_ARRAY]; /**< 0x10: Module name, length given by cchModule. */ } MAPSYMHDR; @@ -91,6 +92,7 @@ typedef struct MAPSYMSEGDEF uint16_t offLineDef; /**< 0x10: Offset to the line defintions. */ uint16_t u16Reserved2; /**< 0x12: Reserved / unknown. Often seen holding 0xff00. */ uint8_t cchSegName; /**< 0x14: Segment name length. */ + RT_FLEXIBLE_ARRAY_EXTENSION char achSegName[RT_FLEXIBLE_ARRAY]; /**< 0x15: Segment name, length given by cchSegName. */ } MAPSYMSEGDEF; @@ -121,6 +123,7 @@ typedef struct MAPSYMLINEDEF uint16_t offLines; /**< 0x04: Offset to the line number array, relative to this structure. */ uint16_t cLines; /**< 0x08: Number of line numbers in the array. */ uint8_t cchSrcFile; /**< 0x0a: Length of source filename. */ + RT_FLEXIBLE_ARRAY_EXTENSION char achSrcFile[RT_FLEXIBLE_ARRAY]; /**< 0x0b: Source filename, length given by cchSrcFile. */ } MAPSYMLINEDEF; diff --git a/src/VBox/Runtime/common/fs/RTFsCmdLs.cpp b/src/VBox/Runtime/common/fs/RTFsCmdLs.cpp index ae9239bb043..0dd42226f17 100644 --- a/src/VBox/Runtime/common/fs/RTFsCmdLs.cpp +++ b/src/VBox/Runtime/common/fs/RTFsCmdLs.cpp @@ -63,6 +63,7 @@ typedef struct RTCMDLSENTRY /** The length of szName. */ size_t cchName; /** The entry name. */ + RT_FLEXIBLE_ARRAY_EXTENSION char szName[RT_FLEXIBLE_ARRAY]; } RTCMDLSENTRY; /** Pointer to a ls display entry. */ @@ -89,6 +90,7 @@ typedef struct RTCMDLSCOLLECTION uint64_t cbTotalFiles; /** The collection name (path). */ + RT_FLEXIBLE_ARRAY_EXTENSION char szName[RT_FLEXIBLE_ARRAY]; } RTCMDLSCOLLECTION; /** Pointer to a display entry collection. */ diff --git a/src/VBox/Runtime/common/fs/fatvfs.cpp b/src/VBox/Runtime/common/fs/fatvfs.cpp index 1654c40fada..3dac9e926ab 100644 --- a/src/VBox/Runtime/common/fs/fatvfs.cpp +++ b/src/VBox/Runtime/common/fs/fatvfs.cpp @@ -319,6 +319,7 @@ typedef struct RTFSFATCLUSTERMAPCACHE /** The cache name. */ const char *pszName; /** Cache entries. */ + RT_FLEXIBLE_ARRAY_EXTENSION RTFSFATCLUSTERMAPENTRY aEntries[RT_FLEXIBLE_ARRAY]; } RTFSFATCLUSTERMAPCACHE; /** Pointer to a FAT linear metadata cache. */ diff --git a/src/VBox/Runtime/common/fs/isomaker.cpp b/src/VBox/Runtime/common/fs/isomaker.cpp index c7d248cdd22..5eecc56eebf 100644 --- a/src/VBox/Runtime/common/fs/isomaker.cpp +++ b/src/VBox/Runtime/common/fs/isomaker.cpp @@ -257,6 +257,7 @@ typedef struct RTFSISOMAKERNAME /** The name length. */ uint16_t cchName; /** The name. */ + RT_FLEXIBLE_ARRAY_EXTENSION char szName[RT_FLEXIBLE_ARRAY]; } RTFSISOMAKERNAME; @@ -447,6 +448,7 @@ typedef struct RTFSISOMAKERSYMLINK /** The symbolic link target length. */ uint16_t cchTarget; /** The symbolic link target. */ + RT_FLEXIBLE_ARRAY_EXTENSION char szTarget[RT_FLEXIBLE_ARRAY]; } RTFSISOMAKERSYMLINK; /** Pointer to an ISO maker directory object. */ diff --git a/src/VBox/Runtime/common/ldr/ldrLX.cpp b/src/VBox/Runtime/common/ldr/ldrLX.cpp index 6992e08af0a..93d16152006 100644 --- a/src/VBox/Runtime/common/ldr/ldrLX.cpp +++ b/src/VBox/Runtime/common/ldr/ldrLX.cpp @@ -156,6 +156,7 @@ typedef struct KLDRMODLX /** Number of segments in aSegments. */ uint32_t cSegments; /** Segment info. */ + RT_FLEXIBLE_ARRAY_EXTENSION RTLDRSEG aSegments[RT_FLEXIBLE_ARRAY]; } KLDRMODLX, *PKLDRMODLX; diff --git a/src/VBox/Runtime/common/vfs/vfsfss2dir.cpp b/src/VBox/Runtime/common/vfs/vfsfss2dir.cpp index 8a92fa0f9c0..a7ac4851a32 100644 --- a/src/VBox/Runtime/common/vfs/vfsfss2dir.cpp +++ b/src/VBox/Runtime/common/vfs/vfsfss2dir.cpp @@ -64,6 +64,7 @@ typedef struct RTVFSFSSWRITE2DIRENTRY #else /** The name (relative to RTVFSFSSWRITE2DIR::szBaseDir). */ #endif + RT_FLEXIBLE_ARRAY_EXTENSION char szName[RT_FLEXIBLE_ARRAY]; } RTVFSFSSWRITE2DIRENTRY; /** Pointer to a RTVFSFSSWRITE2DIR undo entry. */ @@ -86,6 +87,7 @@ typedef struct RTVFSFSSWRITE2DIR RTVFSDIR hVfsBaseDir; #else /** Path to the directory that all operations are relative to. */ + RT_FLEXIBLE_ARRAY_EXTENSION char szBaseDir[RT_FLEXIBLE_ARRAY]; #endif } RTVFSFSSWRITE2DIR; diff --git a/src/VBox/Runtime/common/vfs/vfsstddir.cpp b/src/VBox/Runtime/common/vfs/vfsstddir.cpp index 2852428cd0d..e42ec7d8495 100644 --- a/src/VBox/Runtime/common/vfs/vfsstddir.cpp +++ b/src/VBox/Runtime/common/vfs/vfsstddir.cpp @@ -74,6 +74,7 @@ typedef struct RTVFSSTDSYMLINK /** Pointer to the VFS directory where the symbolic link lives . */ PRTVFSSTDDIR pDir; /** The symbolic link name. */ + RT_FLEXIBLE_ARRAY_EXTENSION char szSymlink[RT_FLEXIBLE_ARRAY]; } RTVFSSTDSYMLINK; /** Pointer to the private data of a standard symbolic link. */ diff --git a/src/VBox/Runtime/generic/ftp-server.cpp b/src/VBox/Runtime/generic/ftp-server.cpp index 7bdae26420a..700deaa761f 100644 --- a/src/VBox/Runtime/generic/ftp-server.cpp +++ b/src/VBox/Runtime/generic/ftp-server.cpp @@ -104,6 +104,7 @@ typedef struct RTFTPDIRENTRY /** The length of szName. */ size_t cchName; /** The entry name. */ + RT_FLEXIBLE_ARRAY_EXTENSION char szName[RT_FLEXIBLE_ARRAY]; } RTFTPDIRENTRY; /** Pointer to a FTP directory entry. */ diff --git a/src/VBox/Runtime/generic/http-curl.cpp b/src/VBox/Runtime/generic/http-curl.cpp index 71b4a44a598..86a3a706644 100644 --- a/src/VBox/Runtime/generic/http-curl.cpp +++ b/src/VBox/Runtime/generic/http-curl.cpp @@ -127,7 +127,8 @@ typedef struct RTHTTPHEADER /** The value offset. */ uint32_t offValue; /** The full header field. */ - char szData[RT_FLEXIBLE_ARRAY]; + RT_FLEXIBLE_ARRAY_EXTENSION + RT_GCC_EXTENSION char szData[RT_FLEXIBLE_ARRAY]; } RTHTTPHEADER; /** Pointer to a HTTP header. */ typedef RTHTTPHEADER *PRTHTTPHEADER; diff --git a/src/VBox/Runtime/tools/RTLdrCheckImports.cpp b/src/VBox/Runtime/tools/RTLdrCheckImports.cpp index e052e42790d..30abcbbc7a7 100644 --- a/src/VBox/Runtime/tools/RTLdrCheckImports.cpp +++ b/src/VBox/Runtime/tools/RTLdrCheckImports.cpp @@ -102,6 +102,7 @@ typedef struct RTCHECKIMPORTSTATE /** Number modules. */ uint32_t cImports; /** Import modules. */ + RT_FLEXIBLE_ARRAY_EXTENSION RTCHECKIMPORTMODULE aImports[RT_FLEXIBLE_ARRAY]; } RTCHECKIMPORTSTATE; /** Pointer to the import checker state. */ diff --git a/src/VBox/ValidationKit/bootsectors/bs3kit/VBoxBs3ObjConverter.cpp b/src/VBox/ValidationKit/bootsectors/bs3kit/VBoxBs3ObjConverter.cpp index 7f3186fac63..ce8e14a3110 100644 --- a/src/VBox/ValidationKit/bootsectors/bs3kit/VBoxBs3ObjConverter.cpp +++ b/src/VBox/ValidationKit/bootsectors/bs3kit/VBoxBs3ObjConverter.cpp @@ -3806,6 +3806,7 @@ typedef struct OMFDETAILSALLOC /** Pointer to the next allocation. */ struct OMFDETAILSALLOC *pNext; /** The allocated bytes. */ + RT_FLEXIBLE_ARRAY_EXTENSION uint8_t abData[RT_FLEXIBLE_ARRAY]; } OMFDETAILSALLOC; typedef OMFDETAILSALLOC *POMFDETAILSALLOC; diff --git a/src/VBox/ValidationKit/utils/fs/FsPerf.cpp b/src/VBox/ValidationKit/utils/fs/FsPerf.cpp index 2b0ee70a1fe..fe3e9924e53 100644 --- a/src/VBox/ValidationKit/utils/fs/FsPerf.cpp +++ b/src/VBox/ValidationKit/utils/fs/FsPerf.cpp @@ -267,6 +267,7 @@ typedef struct FSPERFNAMEENTRY { RTLISTNODE Entry; uint16_t cchName; + RT_FLEXIBLE_ARRAY_EXTENSION char szName[RT_FLEXIBLE_ARRAY]; } FSPERFNAMEENTRY; typedef FSPERFNAMEENTRY *PFSPERFNAMEENTRY; |