]> git.sur5r.net Git - cc65/blobdiff - src/cc65/scanner.c
Removed unused variable.
[cc65] / src / cc65 / scanner.c
index 74ceb6742c4a9137aa885d78ee3859d0b9644473..3a1a40b84a0c016f3374e2fe356a301eda5da10d 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2009, Ullrich von Bassewitz                                      */
+/* (C) 1998-2010, Ullrich von Bassewitz                                      */
 /*                Roemerstrasse 52                                           */
 /*                D-70794 Filderstadt                                        */
 /* EMail:         uz@cc65.org                                                */
@@ -93,6 +93,7 @@ static const struct Keyword {
     { "__Y__",                 TOK_Y,          TT_C89 | TT_C99 | TT_CC65  },
     { "__asm__",               TOK_ASM,        TT_C89 | TT_C99 | TT_CC65  },
     { "__attribute__",         TOK_ATTRIBUTE,  TT_C89 | TT_C99 | TT_CC65  },
+    { "__cdecl__",             TOK_CDECL,      TT_C89 | TT_C99 | TT_CC65  },
     { "__far__",               TOK_FAR,        TT_C89 | TT_C99 | TT_CC65  },
     { "__fastcall__",          TOK_FASTCALL,   TT_C89 | TT_C99 | TT_CC65  },
     { "__inline__",     TOK_INLINE,            TT_C89 | TT_C99 | TT_CC65  },
@@ -101,6 +102,7 @@ static const struct Keyword {
     { "auto",                  TOK_AUTO,       TT_C89 | TT_C99 | TT_CC65  },
     { "break",                 TOK_BREAK,      TT_C89 | TT_C99 | TT_CC65  },
     { "case",                  TOK_CASE,       TT_C89 | TT_C99 | TT_CC65  },
+    { "cdecl",                 TOK_CDECL,                        TT_CC65  },
     { "char",                  TOK_CHAR,       TT_C89 | TT_C99 | TT_CC65  },
     { "const",                 TOK_CONST,      TT_C89 | TT_C99 | TT_CC65  },
     { "continue",              TOK_CONTINUE,   TT_C89 | TT_C99 | TT_CC65  },
@@ -203,8 +205,9 @@ static int SkipWhite (void)
 int TokIsFuncSpec (const Token* T)
 /* Return true if the token is a function specifier */
 {
-    return (T->Tok == TOK_INLINE) || (T->Tok == TOK_FASTCALL) ||
-           (T->Tok == TOK_NEAR)   || (T->Tok == TOK_FAR);
+    return (T->Tok == TOK_INLINE)   ||
+           (T->Tok == TOK_FASTCALL) || (T->Tok == TOK_CDECL) ||
+           (T->Tok == TOK_NEAR)     || (T->Tok == TOK_FAR);
 }
 
 
@@ -407,7 +410,10 @@ static void CharConst (void)
 static void StringConst (void)
 /* Parse a quoted string */
 {
-    NextTok.IVal = GetLiteralPoolOffs ();
+    /* String buffer */
+    StrBuf S = AUTO_STRBUF_INITIALIZER;
+
+    /* Assume next token is a string constant */
     NextTok.Tok  = TOK_SCONST;
 
     /* Concatenate strings. If at least one of the concenated strings is a wide
@@ -436,7 +442,7 @@ static void StringConst (void)
                Error ("Unexpected newline");
                break;
            }
-           AddLiteralChar (ParseChar ());
+                   SB_AppendChar (&S, ParseChar ());
        }
 
        /* Skip closing quote char if there was one */
@@ -448,7 +454,13 @@ static void StringConst (void)
     }
 
     /* Terminate the string */
-    AddLiteralChar ('\0');
+    SB_AppendChar (&S, '\0');
+
+    /* Add the whole string to the literal pool */
+    NextTok.SVal = AddLiteralStr (&S);
+
+    /* Free the buffer */
+    SB_Done (&S);
 }
 
 
@@ -627,7 +639,6 @@ static void NumericConst (void)
         if ((Base == 16 && toupper (CurC) == 'F') ||
             (Base == 10 && toupper (CurC) == 'E')) {
 
-            int Sign;
             unsigned Digits;
             unsigned Exp;
 
@@ -635,9 +646,7 @@ static void NumericConst (void)
             NextChar ();
 
             /* Read an optional sign */
-            Sign = 1;
             if (CurC == '-') {
-                Sign = -1;
                 NextChar ();
             } else if (CurC == '+') {
                 NextChar ();
@@ -751,7 +760,7 @@ void NextToken (void)
        if (token[0] == '_' && token[1] == '_') {
            /* Special symbols */
             if (strcmp (token+2, "FILE__") == 0) {
-               NextTok.IVal = AddLiteral (GetCurrentFile());
+               NextTok.SVal = AddLiteral (GetCurrentFile());
                NextTok.Tok  = TOK_SCONST;
                return;
            } else if (strcmp (token+2, "LINE__") == 0) {
@@ -762,7 +771,7 @@ void NextToken (void)
                    } else if (strcmp (token+2, "func__") == 0) {
                /* __func__ is only defined in functions */
                if (CurrentFunc) {
-                   NextTok.IVal = AddLiteral (F_GetFuncName (CurrentFunc));
+                   NextTok.SVal = AddLiteral (F_GetFuncName (CurrentFunc));
                    NextTok.Tok  = TOK_SCONST;
                    return;
                }