From 125e93e5dc19a2044f3e1dfad2fcb6423315a2a2 Mon Sep 17 00:00:00 2001 From: Rahul Arasikere Date: Wed, 7 Jun 2023 12:54:46 -0400 Subject: [PATCH] fix: CCS compiler pragma for packing structs was incorrect --- source/portable/Compiler/CCS/pack_struct_end.h | 2 ++ source/portable/Compiler/CCS/pack_struct_start.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/source/portable/Compiler/CCS/pack_struct_end.h b/source/portable/Compiler/CCS/pack_struct_end.h index 0a48709bd..a6353c971 100644 --- a/source/portable/Compiler/CCS/pack_struct_end.h +++ b/source/portable/Compiler/CCS/pack_struct_end.h @@ -25,6 +25,8 @@ * * Contains a semicolon to end the wrapped structure, * and resets warnings that were supressed in pack_struct_start.h. + * It also pops the previously pushed alignment of 1 byte of the stack. */ ; +#pragma pack(pop) #pragma diag_pop diff --git a/source/portable/Compiler/CCS/pack_struct_start.h b/source/portable/Compiler/CCS/pack_struct_start.h index ff2a0870d..bd8eb3098 100644 --- a/source/portable/Compiler/CCS/pack_struct_start.h +++ b/source/portable/Compiler/CCS/pack_struct_start.h @@ -25,7 +25,8 @@ * * Also suppress an incorrect warning from the CCS compiler: * error #1916-D: definition at end of file not followed by a semicolon or a declarator + * Pushes the struct alignment of packed. */ #pragma diag_push #pragma diag_suppress=1916 -#pragma pack(1) +#pragma pack(push, 1)