aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorJoe Soroka <gits@joesoroka.com>2011-02-01 00:37:53 -0800
committerJoe Soroka <gits@joesoroka.com>2011-02-01 00:37:53 -0800
commit4d5105c8f1ff1ac4bae592d6c221e5737614bbad (patch)
treeda9af451435028f75a899031d6dc0b7abb5830a4 /tccgen.c
parent6839382480b86362a3dc2807bac7e4bc5d7ef469 (diff)
downloadtinycc-4d5105c8f1ff1ac4bae592d6c221e5737614bbad.tar.gz
tinycc-4d5105c8f1ff1ac4bae592d6c221e5737614bbad.tar.bz2
support weak attribute on variables
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tccgen.c b/tccgen.c
index 3c6adbc..2d7e4ae 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -2922,6 +2922,9 @@ static int parse_btype(CType *type, AttributeDef *ad)
case TOK_ATTRIBUTE1:
case TOK_ATTRIBUTE2:
parse_attribute(ad);
+ if (ad->weak) {
+ t |= VT_WEAK;
+ }
if (ad->mode) {
u = ad->mode -1;
t = (t & ~VT_BTYPE) | u;
@@ -3189,6 +3192,10 @@ static void type_decl(CType *type, AttributeDef *ad, int *v, int td)
post_type(type, ad);
if (tok == TOK_ATTRIBUTE1 || tok == TOK_ATTRIBUTE2)
parse_attribute(ad);
+
+ if (ad->weak)
+ type->t |= VT_WEAK;
+
if (!type1.t)
return;
/* append type at the end of type1 */