mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
Try to fix some DSA-related compiler warnings.
Commit 13df76a537
was overconfident
about how portable %016lx is. Some compilers complain because they
need %016llx, while platforms where DSA pointers are only 32 bits
get unhappy about using a 64-bit format for a 32-bit quantity.
Thomas Munro, per an off-list suggestion from me.
This commit is contained in:
parent
7dd8eb39bd
commit
670b3bc8f5
@ -1099,9 +1099,10 @@ dsa_dump(dsa_area *area)
|
||||
|
||||
span = dsa_get_address(area, span_pointer);
|
||||
fprintf(stderr,
|
||||
" span descriptor at %016lx, "
|
||||
"superblock at %016lx, pages = %zu, "
|
||||
"objects free = %hu/%hu\n",
|
||||
" span descriptor at "
|
||||
DSA_POINTER_FORMAT ", superblock at "
|
||||
DSA_POINTER_FORMAT
|
||||
", pages = %zu, objects free = %hu/%hu\n",
|
||||
span_pointer, span->start, span->npages,
|
||||
span->nallocatable, span->nmax);
|
||||
span_pointer = span->nextspan;
|
||||
|
@ -54,6 +54,7 @@ typedef pg_atomic_uint32 dsa_pointer_atomic;
|
||||
#define dsa_pointer_atomic_write pg_atomic_write_u32
|
||||
#define dsa_pointer_atomic_fetch_add pg_atomic_fetch_add_u32
|
||||
#define dsa_pointer_atomic_compare_exchange pg_atomic_compare_exchange_u32
|
||||
#define DSA_POINTER_FORMAT "%08x"
|
||||
#else
|
||||
typedef uint64 dsa_pointer;
|
||||
typedef pg_atomic_uint64 dsa_pointer_atomic;
|
||||
@ -62,6 +63,7 @@ typedef pg_atomic_uint64 dsa_pointer_atomic;
|
||||
#define dsa_pointer_atomic_write pg_atomic_write_u64
|
||||
#define dsa_pointer_atomic_fetch_add pg_atomic_fetch_add_u64
|
||||
#define dsa_pointer_atomic_compare_exchange pg_atomic_compare_exchange_u64
|
||||
#define DSA_POINTER_FORMAT "%016" INT64_MODIFIER "x"
|
||||
#endif
|
||||
|
||||
/* A sentinel value for dsa_pointer used to indicate failure to allocate. */
|
||||
|
Loading…
Reference in New Issue
Block a user