From: Moritz Kroll Date: Sat, 2 Aug 2008 10:57:50 +0000 (+0000) Subject: cp_error039: Pragma pack not supported X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=192c31683a2cd54b36da2d60002f92bdeadbb9ca;p=cparser cp_error039: Pragma pack not supported [r20938] --- diff --git a/parsetest/cp_error039.c b/parsetest/cp_error039.c new file mode 100644 index 0000000..42b8d74 --- /dev/null +++ b/parsetest/cp_error039.c @@ -0,0 +1,32 @@ +#pragma pack(push,2) +typedef struct teststruct { + char a; + int b; +} teststruct_t; +#pragma pack(pop) + +typedef struct teststruct2 { + char a; + int b; +} teststruct2_t; + +int main(void) +{ + struct teststruct t; + struct teststruct2 t2; + + memset(&t, 0, sizeof(t)); + t.a = 0xEF; + t.b = 0x12345678; + + memset(&t2, 0, sizeof(t2)); + t2.a = 0xEF; + t2.b = 0x12345678; + + printf("%.8X %.2X %.8X %.2X\n", *(unsigned int *) &t, + (unsigned int) *((unsigned char *) &t + 4), + *(unsigned int *) &t2, + (unsigned int) *((unsigned char *) &t2 + 4)); + + return 0; +}