Only assert about x86_64 struct sizes if ABI is LP64, not x32

The __x86_64__ macro identifies a CPU family, and is unfortunately not
enough to identify a concrete ABI.

The normal x86_64 ABI that is used by practical Linux distributions is
LP64 (i.e. 32-bit int, and 64-bit long and pointer), and defines
__x86_64__ and __LP64__.

x32 is a niche ILP32 ABI (i.e. 32-bit int, long and pointer) for x86_64
CPUs, which has different struct sizes due to sizeof(long) and
sizeof(void *) being smaller. It defines __x86_64__ and __ILP32__.

Signed-off-by: Simon McVittie <smcv@debian.org>
This commit is contained in:
Simon McVittie 2020-09-07 14:01:58 +01:00 committed by Wim Taymans
parent b8c58c74d8
commit a652edce0a
7 changed files with 10 additions and 10 deletions

View file

@ -42,7 +42,7 @@ static void test_io_abi(void)
spa_assert(SPA_IO_RateMatch == 8);
spa_assert(SPA_IO_Memory == 9);
#if defined(__x86_64__)
#if defined(__x86_64__) && defined(__LP64__)
spa_assert(sizeof(struct spa_io_buffers) == 8);
spa_assert(sizeof(struct spa_io_memory) == 16);
spa_assert(sizeof(struct spa_io_range) == 16);
@ -69,7 +69,7 @@ static void test_io_abi(void)
spa_assert(SPA_IO_POSITION_STATE_STARTING == 1);
spa_assert(SPA_IO_POSITION_STATE_RUNNING == 2);
#if defined(__x86_64__)
#if defined(__x86_64__) && defined(__LP64__)
spa_assert(sizeof(struct spa_io_position) == 1688);
spa_assert(sizeof(struct spa_io_rate_match) == 48);
#else
@ -210,7 +210,7 @@ static void test_node_abi(void)
spa_assert(SPA_NODE_METHOD_NUM == 15);
spa_assert(sizeof(m) == sizeof(methods));
#if defined(__x86_64__)
#if defined(__x86_64__) && defined(__LP64__)
spa_assert(sizeof(struct spa_node_info) == 48);
spa_assert(sizeof(struct spa_port_info) == 48);