[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] Preprocessor directive "pragma"
From: |
suote127 |
Subject: |
[Tinycc-devel] Preprocessor directive "pragma" |
Date: |
Thu, 19 Aug 2021 18:14:35 +0800 |
User-agent: |
Mutt/1.9.4 (2018-02-28) |
Hello,
At first,I am sorry for my poor English.
I am compiling a program which processes binary data package.To avoid
excess padding,it uses "#pragma" to disable padding.But an error occurred while
compiling with TCC.TCC does not accept pragma option "pack" with only an
operator "push".For example,
#include<stdio.h>
/* This */
#pragma pack(push)
#pragma pack(1)
struct foo {
char c;
int b;
};
/* This */
#pragma pack(pop)
int main(void)
{
printf("%zd\n",sizeof(struct foo));
return 0;
}
Code like the above example works fine for both gcc 7.5.0 and Clang
6.0.0 on Ubuntu 18.04LTS.But tcc failed to compile it.
I made a small patch to fix this problem.All tests are passed(with make
test).
Suote127
diff.patch
Description: Text Data
- [Tinycc-devel] Preprocessor directive "pragma",
suote127 <=