Skip to content

Commit f1d348c

Browse files
author
Daniel Kroening
committed
Visual Studio ignores #pragma pack on unions
1 parent ae1d039 commit f1d348c

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

appveyor.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ test_script:
7070
rmdir /s /q ansi-c\arch_flags_mthumb_good
7171
rmdir /s /q ansi-c\Forward_Declaration2
7272
rmdir /s /q ansi-c\Incomplete_Type1
73-
rmdir /s /q ansi-c\Union_Padding1
7473
rmdir /s /q ansi-c\Universal_characters1
7574
rmdir /s /q ansi-c\function_return1
7675
rmdir /s /q ansi-c\gcc_attributes7

buildspec-windows.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ phases:
3434
Remove-Item ansi-c\arch_flags_mthumb_good -Force -Recurse
3535
Remove-Item ansi-c\Forward_Declaration2 -Force -Recurse
3636
Remove-Item ansi-c\Incomplete_Type1 -Force -Recurse
37-
Remove-Item ansi-c\Union_Padding1 -Force -Recurse
3837
Remove-Item ansi-c\Universal_characters1 -Force -Recurse
3938
Remove-Item ansi-c\function_return1 -Force -Recurse
4039
Remove-Item ansi-c\gcc_attributes7 -Force -Recurse

src/ansi-c/c_typecheck_type.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,13 @@ void c_typecheck_baset::typecheck_compound_body(
927927
if(type.id()==ID_struct)
928928
add_padding(to_struct_type(type), *this);
929929
else if(type.id()==ID_union)
930+
{
931+
// Visual Studio ignores pragma pack on unions
932+
if(config.ansi_c.mode == configt::ansi_ct::flavourt::VISUAL_STUDIO)
933+
type.remove(ID_C_packed);
934+
930935
add_padding(to_union_type(type), *this);
936+
}
931937

932938
// Now remove zero-width bit-fields, these are just
933939
// for adjusting alignment.

0 commit comments

Comments
 (0)