From: cuz Date: Wed, 14 Jun 2000 21:20:45 +0000 (+0000) Subject: New long option --static-locals X-Git-Tag: V2.12.0~3428 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7329d4acb3a7ebeb402d1e5435f82beaeab0fd2c;p=cc65 New long option --static-locals git-svn-id: svn://svn.cc65.org/cc65/trunk@85 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/global.c b/src/cc65/global.c index 42e90431d..ba93b6573 100644 --- a/src/cc65/global.c +++ b/src/cc65/global.c @@ -53,7 +53,7 @@ unsigned char InlineStdFuncs = 0; /* Inline some known functions */ unsigned char EnableRegVars = 0; /* Enable register variables */ unsigned char AllowRegVarAddr = 0; /* Allow taking addresses of register vars */ unsigned char RegVarsToCallStack= 0; /* Save reg variables on call stack */ -unsigned char LocalsAreStatic = 0; /* Make local variables static */ +unsigned char StaticLocals = 0; /* Make local variables static */ unsigned char SignedChars = 0; /* Make characters signed by default */ unsigned char Verbose = 0; /* Verbose flag */ unsigned char AddSource = 0; /* Add source lines as comments */ diff --git a/src/cc65/global.h b/src/cc65/global.h index f4d6f8f31..f384c3852 100644 --- a/src/cc65/global.h +++ b/src/cc65/global.h @@ -70,7 +70,7 @@ extern unsigned char InlineStdFuncs; /* Inline some known functions * extern unsigned char EnableRegVars; /* Enable register variables */ extern unsigned char AllowRegVarAddr; /* Allow taking addresses of register vars */ extern unsigned char RegVarsToCallStack; /* Save reg variables on call stack */ -extern unsigned char LocalsAreStatic; /* Make local variables static */ +extern unsigned char StaticLocals; /* Make local variables static */ extern unsigned char SignedChars; /* Make characters signed by default */ extern unsigned char Verbose; /* Verbose flag */ extern unsigned char AddSource; /* Add source lines as comments */ diff --git a/src/cc65/locals.c b/src/cc65/locals.c index 6a6f2bbb0..ca8715836 100644 --- a/src/cc65/locals.c +++ b/src/cc65/locals.c @@ -245,7 +245,7 @@ void DeclareLocals (void) if (SymbolSC & (SC_AUTO | SC_REGISTER)) { /* Auto variable */ - if (LocalsAreStatic == 0) { + if (StaticLocals == 0) { /* Change SC in case it was register */ SymbolSC = (SymbolSC & ~SC_REGISTER) | SC_AUTO; diff --git a/src/cc65/main.c b/src/cc65/main.c index 083e323b6..6a6e0f6b0 100644 --- a/src/cc65/main.c +++ b/src/cc65/main.c @@ -117,6 +117,7 @@ static void Usage (void) " --help\t\tHelp (this text)\n" " --include-dir dir\tSet an include directory search path\n" " --signed-chars\tDefault characters are signed\n" + " --static-locals\tMake local variables static\n" " --target sys\t\tSet the target system\n" " --verbose\t\tIncrease verbosity\n" " --version\t\tPrint the compiler version number\n", @@ -330,6 +331,14 @@ static void OptSignedChars (const char* Opt, const char* Arg) +static void OptStaticLocals (const char* Opt, const char* Arg) +/* Place local variables in static storage */ +{ + StaticLocals = 1; +} + + + static void OptTarget (const char* Opt, const char* Arg) /* Set the target system */ { @@ -363,13 +372,14 @@ int main (int argc, char* argv[]) { /* Program long options */ static const LongOpt OptTab[] = { - { "--add-source", 0, OptAddSource }, + { "--add-source", 0, OptAddSource }, { "--ansi", 0, OptAnsi }, { "--cpu", 1, OptCPU }, { "--debug-info", 0, OptDebugInfo }, { "--help", 0, OptHelp }, { "--include-dir", 1, OptIncludeDir }, { "--signed-chars", 0, OptSignedChars }, + { "--static-locals", 0, OptStaticLocals }, { "--target", 1, OptTarget }, { "--verbose", 0, OptVerbose }, { "--version", 0, OptVersion }, @@ -440,8 +450,11 @@ int main (int argc, char* argv[]) while (*P) { switch (*P++) { case 'l': - LocalsAreStatic = 1; + OptStaticLocals (Arg, 0); break; + default: + UnknownOption (Arg); + break; } } break; diff --git a/src/cc65/pragma.c b/src/cc65/pragma.c index 907ced7e9..9713f8af0 100644 --- a/src/cc65/pragma.c +++ b/src/cc65/pragma.c @@ -180,7 +180,7 @@ void DoPragma (void) break; case PR_STATICLOCALS: - FlagPragma (&LocalsAreStatic); + FlagPragma (&StaticLocals); break; case PR_ZPSYM: