1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-03 22:29:31 +00:00

A main function not returning an int is not allowed in standard C

git-svn-id: svn://svn.cc65.org/cc65/trunk@3147 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2004-07-06 14:25:48 +00:00
parent 2c3d5773f3
commit 1182d4cbd9

View File

@ -49,6 +49,7 @@
#include "scanner.h"
#include "segments.h"
#include "stackptr.h"
#include "standard.h"
#include "stmt.h"
#include "symtab.h"
#include "function.h"
@ -373,6 +374,13 @@ void NewFunc (SymEntry* Func)
Error ("`main' cannot be declared as __fastcall__");
}
/* If cc65 extensions aren't enabled, don't allow a main function that
* doesn't return an int.
*/
if (IS_Get (&Standard) != STD_CC65 && CurrentFunc->ReturnType[0] != T_INT) {
Error ("`main' must always return an int");
}
/* If main() takes parameters, generate a forced import to a function
* that will setup these parameters. This way, programs that do not
* need the additional code will not get it.