From: Andy Valencia Date: Mon, 18 Jul 2016 01:03:14 +0000 (-0700) Subject: Issue 377: broken calling of function in expressions X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=52e28a6e0bce498a0db6da4f941d4cea9fc62b7e;p=FUZIX.git Issue 377: broken calling of function in expressions --- diff --git a/Applications/SmallC/.gitignore b/Applications/SmallC/.gitignore new file mode 100644 index 00000000..5d899c1a --- /dev/null +++ b/Applications/SmallC/.gitignore @@ -0,0 +1,6 @@ +copt +lscc6801 +lscc6809 +lscc8080 +lsccgeneric +lsccz80 diff --git a/Applications/SmallC/primary.c b/Applications/SmallC/primary.c index 3c802dda..1b443fe8 100644 --- a/Applications/SmallC/primary.c +++ b/Applications/SmallC/primary.c @@ -87,10 +87,13 @@ int primary(LVALUE *lval) { } return FETCH | reg; } - /* Globals and anything we can directly access */ + + /* Globals, function names */ + lval->symbol = symbol; + lval->indirect = 0; if (symbol->identity != FUNCTION) { - lval->symbol = symbol; - lval->indirect = 0; + + /* Globals and anything we can directly access */ if (symbol->type == STRUCT) { lval->tagsym = &tag_table[symbol->tagidx]; } @@ -102,17 +105,21 @@ int primary(LVALUE *lval) { return FETCH | HL_REG; } - if (symbol->storage == LSTATIC) + if (symbol->storage == LSTATIC) { gen_get_locale(symbol); - else { + } else { gen_immediate(); output_string(symbol->name); newline(); } lval->indirect = symbol->type; lval->ptr_type = symbol->type; - return 0; - } + } else { + + /* Function call */ + lval->ptr_type = symbol->type; + } + return 0; } lval->symbol = 0; lval->indirect = 0;