1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-10 07:29:05 +00:00

Memory model additions

git-svn-id: svn://svn.cc65.org/cc65/trunk@2693 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2003-11-29 07:17:31 +00:00
parent add702a2f0
commit b520b182d0
2 changed files with 24 additions and 4 deletions

View File

@ -38,6 +38,8 @@
#include <errno.h>
/* common */
#include "addrsize.h"
#include "mmodel.h"
#include "xmalloc.h"
/* cc65 */
@ -843,6 +845,13 @@ static FuncDesc* ParseFuncDecl (const DeclSpec* Spec)
Sym = Sym->PrevSym;
}
/* Add the default address size for the function */
if (CodeAddrSize == ADDR_SIZE_FAR) {
F->Flags |= FD_FAR;
} else {
F->Flags |= FD_NEAR;
}
/* Leave the lexical level remembering the symbol tables */
RememberFunctionLevel (F);
@ -903,7 +912,10 @@ static void ApplyFunctionModifiers (type* T, unsigned Flags)
Flags &= ~FD_FASTCALL;
}
/* Add the flags */
/* Remove the default function address size modifiers */
F->Flags &= ~(FD_NEAR | FD_FAR);
/* Add the new modifers */
F->Flags |= Flags;
}

View File

@ -556,15 +556,23 @@ static void OptListOptSteps (const char* Opt attribute ((unused)),
static void OptMemoryModel (const char* Opt, const char* Arg)
/* Set the memory model */
{
mmodel_t M;
/* Check the current memory model */
if (MemoryModel != MMODEL_UNKNOWN) {
AbEnd ("Cannot use option `%s' twice", Opt);
}
MemoryModel = FindMemoryModel (Arg);
if (MemoryModel == MMODEL_UNKNOWN) {
/* Translate the memory model name and check it */
M = FindMemoryModel (Arg);
if (M == MMODEL_UNKNOWN) {
AbEnd ("Unknown memory model: %s", Arg);
} else if (MemoryModel == MMODEL_HUGE) {
} else if (M == MMODEL_HUGE) {
AbEnd ("Unsupported memory model: %s", Arg);
}
/* Set the memory model */
SetMemoryModel (M);
}