win: ignore dllimport/dllexport for typedef with warning instead of error

Keep the same as gcc and clang.
The usage exists in MinGW-w64 headers.
This commit is contained in:
YX Hao 2019-06-29 09:42:25 +08:00
parent a4997bf3d9
commit 756e766295

View File

@ -7685,9 +7685,13 @@ static int decl0(int l, int is_for_loop_init, Sym *func_sym)
#ifdef TCC_TARGET_PE
if (ad.a.dllimport || ad.a.dllexport) {
if (type.t & (VT_STATIC|VT_TYPEDEF))
tcc_error("cannot have dll linkage with static or typedef");
if (ad.a.dllimport) {
if (type.t & VT_STATIC)
tcc_error("cannot have dll linkage with static");
if (type.t & VT_TYPEDEF) {
tcc_warning("'%s' attribute ignored for typedef",
ad.a.dllimport ? (ad.a.dllimport = 0, "dllimport") :
(ad.a.dllexport = 0, "dllexport"));
} else if (ad.a.dllimport) {
if ((type.t & VT_BTYPE) == VT_FUNC)
ad.a.dllimport = 0;
else