| @@ -3865,6 +3865,18 @@ do_decl: · 3864 unmodified lines |
| 3865 | } | 3865 | } |
| 3866 | } | 3866 | } |
| 3867 | | 3867 | |
| | 3868 | static void sym_to_attr(AttributeDef *ad, Sym *s) |
| | 3869 | { |
| | 3870 | if (s->a.aligned && 0 == ad->a.aligned) |
| | 3871 | ad->a.aligned = s->a.aligned; |
| | 3872 | if (s->f.func_call && 0 == ad->f.func_call) |
| | 3873 | ad->f.func_call = s->f.func_call; |
| | 3874 | if (s->f.func_type && 0 == ad->f.func_type) |
| | 3875 | ad->f.func_type = s->f.func_type; |
| | 3876 | if (s->a.packed) |
| | 3877 | ad->a.packed = 1; |
| | 3878 | } |
| | 3879 | |
| 3868 | /* Add type qualifiers to a type. If the type is an array then the qualifiers | 3880 | /* Add type qualifiers to a type. If the type is an array then the qualifiers |
| 3869 | are added to the element type, copied because it could be a typedef. */ | 3881 | are added to the element type, copied because it could be a typedef. */ |
| 3870 | static void parse_btype_qualify(CType *type, int qualifiers) | 3882 | static void parse_btype_qualify(CType *type, int qualifiers) |
| @@ -4060,6 +4072,8 @@ static int parse_btype(CType *type, AttributeDef *ad) · 189 unmodified lines |
| 4060 | parse_expr_type(&type1); | 4072 | parse_expr_type(&type1); |
| 4061 | /* remove all storage modifiers except typedef */ | 4073 | /* remove all storage modifiers except typedef */ |
| 4062 | type1.t &= ~(VT_STORAGE&~VT_TYPEDEF); | 4074 | type1.t &= ~(VT_STORAGE&~VT_TYPEDEF); |
| | 4075 | if (type1.ref) |
| | 4076 | sym_to_attr(ad, type1.ref); |
| 4063 | goto basic_type2; | 4077 | goto basic_type2; |
| 4064 | default: | 4078 | default: |
| 4065 | if (typespec_found) | 4079 | if (typespec_found) |
| @@ -4075,12 +4089,7 @@ static int parse_btype(CType *type, AttributeDef *ad) · 9 unmodified lines |
| 4075 | parse_btype_qualify(type, t); | 4089 | parse_btype_qualify(type, t); |
| 4076 | t = type->t; | 4090 | t = type->t; |
| 4077 | /* get attributes from typedef */ | 4091 | /* get attributes from typedef */ |
| 4078 | if (s->a.aligned && 0 == ad->a.aligned) | 4092 | sym_to_attr(ad, s); |
| 4079 | ad->a.aligned = s->a.aligned; | | |
| 4080 | if (s->f.func_call && 0 == ad->f.func_call) | | |
| 4081 | ad->f.func_call = s->f.func_call; | | |
| 4082 | if (s->a.packed) | | |
| 4083 | ad->a.packed = 1; | | |
| 4084 | next(); | 4093 | next(); |
| 4085 | typespec_found = 1; | 4094 | typespec_found = 1; |
| 4086 | st = bt = -2; | 4095 | st = bt = -2; |
| @@ -6978,7 +6987,7 @@ static void gen_inline_functions(TCCState *s) · 2891 unmodified lines |
| 6978 | | 6987 | |
| 6979 | ln = file->line_num; | 6988 | ln = file->line_num; |
| 6980 | /* iterate while inline function are referenced */ | 6989 | /* iterate while inline function are referenced */ |
| 6981 | for(;;) { | 6990 | do { |
| 6982 | inline_generated = 0; | 6991 | inline_generated = 0; |
| 6983 | for (i = 0; i < s->nb_inline_fns; ++i) { | 6992 | for (i = 0; i < s->nb_inline_fns; ++i) { |
| 6984 | fn = s->inline_fns[i]; | 6993 | fn = s->inline_fns[i]; |
| @@ -7000,9 +7009,7 @@ static void gen_inline_functions(TCCState *s) · 15 unmodified lines |
| 7000 | inline_generated = 1; | 7009 | inline_generated = 1; |
| 7001 | } | 7010 | } |
| 7002 | } | 7011 | } |
| 7003 | if (!inline_generated) | 7012 | } while (inline_generated); |
| 7004 | break; | | |
| 7005 | } | | |
| 7006 | file->line_num = ln; | 7013 | file->line_num = ln; |
| 7007 | } | 7014 | } |
| 7008 | | 7015 | |
| @@ -7229,12 +7236,13 @@ found: · 220 unmodified lines |
| 7229 | sym = sym_push(v, &type, 0, 0); | 7236 | sym = sym_push(v, &type, 0, 0); |
| 7230 | } | 7237 | } |
| 7231 | sym->a = ad.a; | 7238 | sym->a = ad.a; |
| | 7239 | sym->f = ad.f; |
| 7232 | } else { | 7240 | } else { |
| 7233 | r = 0; | 7241 | r = 0; |
| 7234 | if ((type.t & VT_BTYPE) == VT_FUNC) { | 7242 | if ((type.t & VT_BTYPE) == VT_FUNC) { |
| 7235 | /* external function definition */ | 7243 | /* external function definition */ |
| 7236 | /* specific case for func_call attribute */ | 7244 | /* specific case for func_call attribute */ |
| 7237 | type.ref->a = ad.a; | 7245 | type.ref->f = ad.f; |
| 7238 | } else if (!(type.t & VT_ARRAY)) { | 7246 | } else if (!(type.t & VT_ARRAY)) { |
| 7239 | /* not lvalue if array */ | 7247 | /* not lvalue if array */ |
| 7240 | r |= lvalue_type(type.t); | 7248 | r |= lvalue_type(type.t); |