aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLinus Torvalds <torvalds@home.transmeta.com>2003-04-11 17:50:02 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:00:30 -0700
commitaffb6d1c90f57ae80fab6b74d0272f7bc9cf683b (patch)
tree46855a83e12560e4007713155929194c79d3603a
parentd70f368133087051e0d1507f1487d97f35412d08 (diff)
downloadsparse-dev-affb6d1c90f57ae80fab6b74d0272f7bc9cf683b.tar.gz
Mark all function declarations automatically extern unless they
are static.
-rw-r--r--parse.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/parse.c b/parse.c
index 5f05a315..91569f66 100644
--- a/parse.c
+++ b/parse.c
@@ -955,7 +955,8 @@ static struct token *external_declaration(struct token *token, struct symbol_lis
add_symbol(list, decl);
return expect(token, '}', "at end of function");
}
- decl->ctype.modifiers |= MOD_EXTERN;
+ if (!(decl->ctype.modifiers & MOD_STATIC))
+ decl->ctype.modifiers |= MOD_EXTERN;
}
for (;;) {
@@ -983,6 +984,13 @@ static struct token *external_declaration(struct token *token, struct symbol_lis
}
bind_symbol(decl, ident, is_typedef ? NS_TYPEDEF: NS_SYMBOL);
+
+ /* Function declarations are automatically extern unless specifically static */
+ base_type = decl->ctype.base_type;
+ if (!is_typedef && base_type && base_type->type == SYM_FN) {
+ if (!(decl->ctype.modifiers & MOD_STATIC))
+ decl->ctype.modifiers |= MOD_EXTERN;
+ }
}
return expect(token, ';', "at end of declaration");
}