From: kvigor Date: Fri, 6 Oct 2000 20:00:28 +0000 (+0000) Subject: Force function prototypes to default to extern storage class X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=030205e37631e66a515c78899408cccf3449ed0b;p=fw%2Fsdcc Force function prototypes to default to extern storage class git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@446 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCC.y b/src/SDCC.y index ab463d4b..c4af2094 100644 --- a/src/SDCC.y +++ b/src/SDCC.y @@ -125,6 +125,23 @@ file external_definition : function_definition { blockNo=0;} | declaration { + if ($1 && $1->type + && IS_FUNC($1->type)) + { + /* The only legal storage classes for + * a function prototype (declaration) + * are extern and static. extern is the + * default. Thus, if this function isn't + * explicitly marked static, mark it + * extern. + */ + if ($1->etype + && IS_SPEC($1->etype) + && !SPEC_STAT($1->etype)) + { + SPEC_EXTR($1->etype) = 1; + } + } addSymChain ($1); allocVariables ($1) ; cleanUpLevel (SymbolTab,1);