mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-20 05:18:21 +08:00
mdbx: fix zero-length arrays for C++.
Change-Id: I24ee4b34064f1face40d63861fb2f8982b922f7d
This commit is contained in:
parent
f4021c8028
commit
7ce33be933
@ -242,7 +242,7 @@ typedef union mdbx_safe64 {
|
||||
#if MDBX_64BIT_ATOMIC
|
||||
volatile uint64_t atomic;
|
||||
#endif /* MDBX_64BIT_ATOMIC */
|
||||
struct {
|
||||
__anonymous_struct_extension__ struct {
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
volatile uint32_t low;
|
||||
volatile uint32_t high;
|
||||
@ -364,7 +364,7 @@ typedef struct MDBX_page {
|
||||
#define P_KEEP 0x8000 /* leave this page alone during spill */
|
||||
uint16_t mp_flags;
|
||||
union {
|
||||
struct {
|
||||
__anonymous_struct_extension__ struct {
|
||||
indx_t mp_lower; /* lower bound of free space */
|
||||
indx_t mp_upper; /* upper bound of free space */
|
||||
};
|
||||
@ -372,8 +372,10 @@ typedef struct MDBX_page {
|
||||
};
|
||||
pgno_t mp_pgno; /* page number */
|
||||
|
||||
/* dynamic size */
|
||||
indx_t mp_ptrs[/* C99 */];
|
||||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
|
||||
(!defined(__cplusplus) && defined(_MSC_VER))
|
||||
indx_t mp_ptrs[] /* dynamic size */;
|
||||
#endif /* C99 */
|
||||
} MDBX_page;
|
||||
|
||||
/* Size of the page header, excluding dynamic data at the end */
|
||||
@ -551,8 +553,11 @@ typedef struct MDBX_lockinfo {
|
||||
volatile unsigned mti_numreaders;
|
||||
volatile unsigned mti_readers_refresh_flag;
|
||||
|
||||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
|
||||
(!defined(__cplusplus) && defined(_MSC_VER))
|
||||
alignas(MDBX_CACHELINE_SIZE) /* cacheline ---------------------------------*/
|
||||
MDBX_reader mti_readers[/* C99 */];
|
||||
MDBX_reader mti_readers[] /* dynamic size */;
|
||||
#endif /* C99 */
|
||||
} MDBX_lockinfo;
|
||||
|
||||
/* Lockfile format signature: version, features and field layout */
|
||||
@ -629,11 +634,11 @@ typedef txnid_t *MDBX_TXL;
|
||||
|
||||
/* An Dirty-Page list item is an pgno/pointer pair. */
|
||||
typedef union MDBX_DP {
|
||||
struct {
|
||||
__anonymous_struct_extension__ struct {
|
||||
pgno_t pgno;
|
||||
MDBX_page *ptr;
|
||||
};
|
||||
struct {
|
||||
__anonymous_struct_extension__ struct {
|
||||
unsigned sorted;
|
||||
unsigned length;
|
||||
};
|
||||
@ -1297,7 +1302,11 @@ typedef struct MDBX_node {
|
||||
|
||||
/* valid flags for mdbx_node_add() */
|
||||
#define NODE_ADD_FLAGS (F_DUPDATA | F_SUBDATA | MDBX_RESERVE | MDBX_APPEND)
|
||||
uint8_t mn_data[/* C99 */]; /* key and data are appended here */
|
||||
|
||||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
|
||||
(!defined(__cplusplus) && defined(_MSC_VER))
|
||||
uint8_t mn_data[] /* key and data are appended here */;
|
||||
#endif /* C99 */
|
||||
} MDBX_node;
|
||||
|
||||
#define DB_PERSISTENT_FLAGS \
|
||||
|
Loading…
x
Reference in New Issue
Block a user