mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-17 03:00:21 +02:00
FFI: sizeof: Account for trailing padding of structs.
* libguile/foreign.c (scm_sizeof): Make sure the overall size is a multiple of the alignment of the structure. * test-suite/tests/foreign.test: Test size of { double, int8 }.
This commit is contained in:
parent
0854b87493
commit
67d8ccc0e4
2 changed files with 7 additions and 2 deletions
|
@ -342,6 +342,10 @@
|
|||
(= (sizeof (list int8 double))
|
||||
(+ (alignof double) (sizeof double))))
|
||||
|
||||
(pass-if "sizeof { double, int8 }"
|
||||
(= (sizeof (list double int8))
|
||||
(+ (alignof double) (sizeof double))))
|
||||
|
||||
(pass-if "sizeof { short, int, long, pointer }"
|
||||
(let ((layout (list short int long '*)))
|
||||
(>= (sizeof layout)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue