fixes and changes the recently introduced 'alignas' to be 'align' (#12666)

* fixes and changes the recently introduced 'alignas' to be 'align'

* more improvements
This commit is contained in:
Andreas Rumpf 2019-11-15 20:24:14 +01:00 • committed by GitHub
commit 58f3e07b1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 50 additions and 44 deletions

View file

@ -336,10 +336,10 @@ testinstance:
a: int32
b: T
# this type mixes `packed` with `alignas`.
# this type mixes `packed` with `align`.
MyCustomAlignPackedObject {.objectconfig.} = object
a: char
b {.alignas: 32.}: int32 # alignas overrides `packed` for this field.
b {.align: 32.}: int32 # align overrides `packed` for this field.
c: char
d: int32 # unaligned
@ -496,11 +496,11 @@ type
MyCustomAlignUnion {.union.} = object
c: char
a {.alignas: 32.}: int
a {.align: 32.}: int
MyCustomAlignObject = object
c: char
a {.alignas: 32.}: int
a {.align: 32.}: int
doAssert sizeof(MyUnionType) == 4
doAssert sizeof(MyCustomAlignUnion) == 32