1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-14 00:32:08 +00:00

Calling an undefined function is an error in C99.

git-svn-id: svn://svn.cc65.org/cc65/trunk@3857 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2008-07-31 18:30:33 +00:00
parent b5511acf6f
commit 52c0c284da

View File

@ -31,6 +31,7 @@
#include "scanner.h"
#include "shiftexpr.h"
#include "stackptr.h"
#include "standard.h"
#include "stdfunc.h"
#include "symtab.h"
#include "typecmp.h"
@ -688,11 +689,17 @@ static void Primary (ExprDesc* E)
/* IDENT is either an auto-declared function or an undefined variable. */
if (CurTok.Tok == TOK_LPAREN) {
/* Declare a function returning int. For that purpose, prepare a
/* C99 doesn't allow calls to undefined functions, so
* generate an error and otherwise a warning. Declare a
* function returning int. For that purpose, prepare a
* function signature for a function having an empty param list
* and returning int.
*/
Warning ("Function call without a prototype");
if (IS_Get (&Standard) >= STD_C99) {
Error ("Call to undefined function `%s'", Ident);
} else {
Warning ("Call to undefined function `%s'", Ident);
}
Sym = AddGlobalSym (Ident, GetImplicitFuncType(), SC_EXTERN | SC_REF | SC_FUNC);
E->Type = Sym->Type;
E->Flags = E_LOC_GLOBAL | E_RTYPE_RVAL;