Require parentheses for #align(N)

This commit is contained in:
gingerBill
2023-08-15 14:55:02 +01:00
parent 098d1d2b5e
commit 2cc22d118d
17 changed files with 63 additions and 48 deletions
+1 -1
View File
@@ -257,7 +257,7 @@ Typeid_Kind :: enum u8 {
}
#assert(len(Typeid_Kind) < 32)
// Typeid_Bit_Field :: bit_field #align align_of(uintptr) {
// Typeid_Bit_Field :: bit_field #align(align_of(uintptr)) {
// index: 8*size_of(uintptr) - 8,
// kind: 5, // Typeid_Kind
// named: 1,
+1 -1
View File
@@ -87,7 +87,7 @@ MAP_CACHE_LINE_SIZE :: 1 << MAP_CACHE_LINE_LOG2
//
// In the optimal case, len(Map_Cell(T){}.data) = 1 so the cell array can be treated
// as a regular array of T, which is the case for hashes.
Map_Cell :: struct($T: typeid) #align MAP_CACHE_LINE_SIZE {
Map_Cell :: struct($T: typeid) #align(MAP_CACHE_LINE_SIZE) {
data: [MAP_CACHE_LINE_SIZE / size_of(T) when 0 < size_of(T) && size_of(T) < MAP_CACHE_LINE_SIZE else 1]T,
}
+4 -3
View File
@@ -398,9 +398,9 @@ print_type :: proc "contextless" (ti: ^Type_Info) {
if info.is_packed { print_string("#packed ") }
if info.is_raw_union { print_string("#raw_union ") }
if info.custom_align {
print_string("#align ")
print_string("#align(")
print_u64(u64(ti.align))
print_byte(' ')
print_string(") ")
}
print_byte('{')
for name, i in info.names {
@@ -414,8 +414,9 @@ print_type :: proc "contextless" (ti: ^Type_Info) {
case Type_Info_Union:
print_string("union ")
if info.custom_align {
print_string("#align ")
print_string("#align(")
print_u64(u64(ti.align))
print_string(") ")
}
if info.no_nil {
print_string("#no_nil ")