From 1182d4cbd9e6b338baf9df844a51ed6d4710f01b Mon Sep 17 00:00:00 2001 From: cuz Date: Tue, 6 Jul 2004 14:25:48 +0000 Subject: [PATCH] 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 --- src/cc65/function.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/cc65/function.c b/src/cc65/function.c index d4409afba..bed87a574 100644 --- a/src/cc65/function.c +++ b/src/cc65/function.c @@ -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. -- 2.39.5