authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-07 01:56:42+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-10-07 01:56:42+02:00
logaa8f39e2711dc2e9659e1c4d7388467c45271836
treec621e84dbdda92d5ca1a271f5a99b66843cacba2
parent790fc8cd98020c26b65a4af69e25c4e853d463be
parent770aa54579130bd539670ebad18534e1bb2f6e80
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #21614 from alexrp/target-avr-align

`std.Target`: Fix `cTypePreferredAlignment()` to always return 1 for avr.

1 files changed, 7 insertions(+), 8 deletions(-)

lib/std/Target.zig+7-8
...@@ -2637,7 +2637,6 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {...@@ -2637,7 +2637,6 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
2637 },2637 },
26382638
2639 .msp430,2639 .msp430,
2640 .avr,
2641 => 2,2640 => 2,
26422641
2643 .arc,2642 .arc,
...@@ -2686,6 +2685,9 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {...@@ -2686,6 +2685,9 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
2686 .wasm32,2685 .wasm32,
2687 .wasm64,2686 .wasm64,
2688 => 16,2687 => 16,
2688
2689 .avr,
2690 => unreachable, // Handled above.
2689 }),2691 }),
2690 );2692 );
2691}2693}
...@@ -2720,12 +2722,7 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 {...@@ -2720,12 +2722,7 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 {
2720 .longdouble => return 4,2722 .longdouble => return 4,
2721 else => {},2723 else => {},
2722 },2724 },
2723 .avr => switch (c_type) {2725 .avr => return 1,
2724 .char, .int, .uint, .long, .ulong, .float, .longdouble => return 1,
2725 .short, .ushort => return 2,
2726 .double => return 4,
2727 .longlong, .ulonglong => return 8,
2728 },
2729 .x86 => switch (target.os.tag) {2726 .x86 => switch (target.os.tag) {
2730 .windows, .uefi => switch (c_type) {2727 .windows, .uefi => switch (c_type) {
2731 .longdouble => switch (target.abi) {2728 .longdouble => switch (target.abi) {
...@@ -2761,7 +2758,6 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 {...@@ -2761,7 +2758,6 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 {
2761 .arc,2758 .arc,
2762 .arm,2759 .arm,
2763 .armeb,2760 .armeb,
2764 .avr,
2765 .thumb,2761 .thumb,
2766 .thumbeb,2762 .thumbeb,
2767 .amdgcn,2763 .amdgcn,
...@@ -2799,6 +2795,9 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 {...@@ -2799,6 +2795,9 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 {
2799 .wasm32,2795 .wasm32,
2800 .wasm64,2796 .wasm64,
2801 => 16,2797 => 16,
2798
2799 .avr,
2800 => unreachable, // Handled above.
2802 }),2801 }),
2803 );2802 );
2804}2803}