diff options
| author | Linus Torvalds <torvalds@home.transmeta.com> | 2003-04-11 17:50:02 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:00:30 -0700 |
| commit | affb6d1c90f57ae80fab6b74d0272f7bc9cf683b (patch) | |
| tree | 46855a83e12560e4007713155929194c79d3603a | |
| parent | d70f368133087051e0d1507f1487d97f35412d08 (diff) | |
| download | sparse-dev-affb6d1c90f57ae80fab6b74d0272f7bc9cf683b.tar.gz | |
Mark all function declarations automatically extern unless they
are static.
| -rw-r--r-- | parse.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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"); } |
