]> git.sur5r.net Git - cc65/commitdiff
New long option --static-locals
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 14 Jun 2000 21:20:45 +0000 (21:20 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 14 Jun 2000 21:20:45 +0000 (21:20 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@85 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cc65/global.c
src/cc65/global.h
src/cc65/locals.c
src/cc65/main.c
src/cc65/pragma.c

index 42e90431d5b8b226636d7b9b1663d2009e60a55f..ba93b657345300450c817a4a391b08c08bbc2788 100644 (file)
@@ -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 */
index f4d6f8f314b39c41d52548fa2d3a8e7297d520d3..f384c3852d2021dce89911a41a3467dcf6a25cef 100644 (file)
@@ -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 */
index 6a6f2bbb067e411bb32690822230b35bb611f43a..ca8715836702412733a13acb9e6d0708686e42a4 100644 (file)
@@ -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;
index 083e323b6a65df39b5dd99a51e96cbb000382eea..6a6e0f6b08c754398c335afc378160c4f1b1ee58 100644 (file)
@@ -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;
index 907ced7e9a0c3da44daeaab0e56d662332d67255..9713f8af05be7af6f9e7d8457ed03d1c227d95fa 100644 (file)
@@ -180,7 +180,7 @@ void DoPragma (void)
            break;
 
        case PR_STATICLOCALS:
-           FlagPragma (&LocalsAreStatic);
+           FlagPragma (&StaticLocals);
            break;
 
        case PR_ZPSYM: