]> git.sur5r.net Git - cc65/commitdiff
Fixed warnings generated by clang (run by Per Olofsson).
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 28 Sep 2009 15:59:18 +0000 (15:59 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 28 Sep 2009 15:59:18 +0000 (15:59 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@4255 b7a2c559-68d2-44c3-8de9-860c34a00d81

14 files changed:
src/ca65/listing.c
src/ca65/nexttok.c
src/ca65/pseudo.c
src/cc65/codeent.c
src/cc65/codegen.c
src/cc65/codeseg.c
src/cc65/compile.c
src/cc65/error.c
src/cc65/preproc.c
src/cc65/scanner.c
src/cc65/stmt.c
src/da65/handler.c
src/ld65/scanner.c
src/od65/dump.c

index 911c27db2b3c1649c3b9dc718a2d3b51c344ad88..37dbcd2c98f1a6e0164db65cadea1e31c590fc4e 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000-2008 Ullrich von Bassewitz                                       */
-/*               Roemerstrasse 52                                            */
-/*               D-70794 Filderstadt                                         */
-/* EMail:        uz@cc65.org                                                 */
+/* (C) 2000-2009, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -218,7 +218,7 @@ static void PrintPageHeader (FILE* F, const ListLine* L)
 /* Print the header for a new page. It is assumed that the given line is the
  * last line of the previous page.
  */
-{                         
+{
     /* Gte a pointer to the current input file */
     const StrBuf* CurFile = GetFileName (L->File);
 
@@ -231,7 +231,7 @@ static void PrintPageHeader (FILE* F, const ListLine* L)
             VER_MAJOR, VER_MINOR, VER_PATCH,
              Copyright,
             InFile,
-            SB_GetLen (CurFile), SB_GetConstBuf (CurFile));
+            (int) SB_GetLen (CurFile), SB_GetConstBuf (CurFile));
 
     /* Count pages, reset lines */
     ++PageNumber;
index b5ae2ecb1cba721fd7fb14e32e728476bc48f70c..cb76bdb18530d4d5cbebb3b34d0fe9e074670653 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000-2008 Ullrich von Bassewitz                                       */
-/*               Roemerstrasse 52                                            */
-/*               D-70794 Filderstadt                                         */
-/* EMail:        uz@cc65.org                                                 */
+/* (C) 2000-2009, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -707,7 +707,7 @@ void Consume (Token Expected, const char* ErrMsg)
     if (Tok == Expected) {
        NextTok ();
     } else {
-       Error (ErrMsg);
+               Error ("%s", ErrMsg);
     }
 }
 
index 55383b935bac189a8db5d6392ee57df9b8612c2f..00c9bdc722444c2a6e41c57e8a591bb101005c96 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2008, Ullrich von Bassewitz                                      */
+/* (C) 1998-2009, Ullrich von Bassewitz                                      */
 /*                Roemerstrasse 52                                           */
 /*                D-70794 Filderstadt                                        */
 /* EMail:         uz@cc65.org                                                */
@@ -1356,7 +1356,7 @@ static void DoOut (void)
        /* Output the string and be sure to flush the output to keep it in
         * sync with any error messages if the output is redirected to a file.
         */
-       printf ("%*s\n", SB_GetLen (&SVal), SB_GetConstBuf (&SVal));
+       printf ("%.*s\n", (int) SB_GetLen (&SVal), SB_GetConstBuf (&SVal));
        fflush (stdout);
        NextTok ();
     }
index 546786b7ac99573fbf429550e7f9be3c2b09b277..8c73081b6705f6416fbf1d0a42f9dcf0646b9cf8 100644 (file)
@@ -1373,6 +1373,7 @@ void CE_Output (const CodeEntry* E)
 {
     const OPCDesc* D;
     unsigned Chars;
+    int Space;
     const char* Target;
 
     /* If we have a label, print that */
@@ -1387,6 +1388,9 @@ void CE_Output (const CodeEntry* E)
 
     /* Print the mnemonic */
     Chars = WriteOutput ("\t%s", D->Mnemo);
+              
+    /* Space to leave before the operand */
+    Space = 9 - Chars;
 
     /* Print the operand */
     switch (E->AM) {
@@ -1397,50 +1401,50 @@ void CE_Output (const CodeEntry* E)
 
        case AM65_ACC:
            /* accumulator */
-           Chars += WriteOutput ("%*sa", 9-Chars, "");
+           Chars += WriteOutput ("%*sa", Space, "");
            break;
 
        case AM65_IMM:
            /* immidiate */
-           Chars += WriteOutput ("%*s#%s", 9-Chars, "", E->Arg);
+           Chars += WriteOutput ("%*s#%s", Space, "", E->Arg);
            break;
 
        case AM65_ZP:
        case AM65_ABS:
            /* zeropage and absolute */
-           Chars += WriteOutput ("%*s%s", 9-Chars, "", E->Arg);
+           Chars += WriteOutput ("%*s%s", Space, "", E->Arg);
                    break;
 
        case AM65_ZPX:
        case AM65_ABSX:
            /* zeropage,X and absolute,X */
-           Chars += WriteOutput ("%*s%s,x", 9-Chars, "", E->Arg);
+           Chars += WriteOutput ("%*s%s,x", Space, "", E->Arg);
            break;
 
        case AM65_ABSY:
            /* absolute,Y */
-           Chars += WriteOutput ("%*s%s,y", 9-Chars, "", E->Arg);
+           Chars += WriteOutput ("%*s%s,y", Space, "", E->Arg);
            break;
 
        case AM65_ZPX_IND:
            /* (zeropage,x) */
-                   Chars += WriteOutput ("%*s(%s,x)", 9-Chars, "", E->Arg);
+                   Chars += WriteOutput ("%*s(%s,x)", Space, "", E->Arg);
            break;
 
        case AM65_ZP_INDY:
            /* (zeropage),y */
-                   Chars += WriteOutput ("%*s(%s),y", 9-Chars, "", E->Arg);
+                   Chars += WriteOutput ("%*s(%s),y", Space, "", E->Arg);
            break;
 
        case AM65_ZP_IND:
            /* (zeropage) */
-                   Chars += WriteOutput ("%*s(%s)", 9-Chars, "", E->Arg);
+                   Chars += WriteOutput ("%*s(%s)", Space, "", E->Arg);
            break;
 
        case AM65_BRA:
            /* branch */
            Target = E->JumpTo? E->JumpTo->Name : E->Arg;
-           Chars += WriteOutput ("%*s%s", 9-Chars, "", Target);
+           Chars += WriteOutput ("%*s%s", Space, "", Target);
            break;
 
        default:
@@ -1449,11 +1453,11 @@ void CE_Output (const CodeEntry* E)
     }
 
     /* Print usage info if requested by the debugging flag */
-    if (Debug) {
+    if (Debug) {                    
        char Use [128];
        char Chg [128];
                WriteOutput ("%*s; USE: %-12s CHG: %-12s SIZE: %u",
-                            30-Chars, "",
+                            (int)(30-Chars), "",
                     RegInfoDesc (E->Use, Use),
                     RegInfoDesc (E->Chg, Chg),
                     E->Size);
index 76077ab30655f1bd9367dfdddf6547fd7a063b0f..abb8a6ec43a67989dc4e07d634d978a06da9eafa 100644 (file)
@@ -929,7 +929,7 @@ void g_getind (unsigned Flags, unsigned Offs)
 void g_leasp (int Offs)
 /* Fetch the address of the specified symbol into the primary register */
 {
-    unsigned char Lo, Hi;              
+    unsigned char Lo, Hi;
 
     /* Calculate the offset relative to sp */
     Offs -= StackPtr;
@@ -4230,7 +4230,7 @@ void g_defbytes (const void* Bytes, unsigned Count)
         } while (Chunk);
 
         /* Output the line */
-        AddDataLine (Buf);
+        AddDataLine ("%s", Buf);
     }
 }
 
@@ -4407,7 +4407,7 @@ void g_switch (Collection* Nodes, unsigned DefaultLabel, unsigned Depth)
 void g_asmcode (struct StrBuf* B)
 /* Output one line of assembler code. */
 {
-    AddCodeLine ("%.*s", SB_GetLen (B), SB_GetConstBuf (B));
+    AddCodeLine ("%.*s", (int) SB_GetLen (B), SB_GetConstBuf (B));
 }
 
 
index 36fdc05b6e853d537434ccd00b0434f9dd4703e2..492a322b969438dac42b5304b59dac928f207168 100644 (file)
@@ -1079,7 +1079,7 @@ void CS_DelCodeRange (CodeSeg* S, unsigned First, unsigned Last)
     if (CE_HasLabel (FirstEntry)) {
         /* Get the entry following last */
         CodeEntry* FollowingEntry = CS_GetNextEntry (S, Last);
-        if (FollowingEntry) {       
+        if (FollowingEntry) {
             /* There is an entry after Last - move the labels */
             CS_MoveLabels (S, FirstEntry, FollowingEntry);
         } else {
@@ -1395,7 +1395,7 @@ void CS_Output (CodeSeg* S)
                     const char* N = strchr (L, '\n');
                     if (N) {
                         /* We have a newline, just write the first part */
-                        WriteOutput ("%.*s\n; ", N - L, L);
+                        WriteOutput ("%.*s\n; ", (int) (N - L), L);
                         L = N+1;
                     } else {
                         /* No Newline, write as is */
index befb1e9c682a35d95d9da15ffa98e866aca26169..9e2f23fce21d7fc13413d4a0841d982b56f73ae4 100644 (file)
@@ -356,7 +356,7 @@ void Compile (const char* FileName)
         /* Preprocess each line and write it to the output file */
         while (NextLine ()) {
             Preprocess ();
-            WriteOutput ("%.*s\n", SB_GetLen (Line), SB_GetConstBuf (Line));
+            WriteOutput ("%.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line));
         }
 
         /* Close the output file */
index 9a41afe981e24a01f897ce31ebf530d894baabd3..694ccdd01deaed5bcadf088821e475019a56c121 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2004 Ullrich von Bassewitz                                       */
-/*               Römerstraße 52                                              */
-/*               D-70794 Filderstadt                                         */
-/* EMail:        uz@cc65.org                                                 */
+/* (C) 1998-2009, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -77,7 +77,7 @@ static void IntWarning (const char* Filename, unsigned LineNo, const char* Msg,
        fprintf (stderr, "\n");
 
         if (Line) {
-           Print (stderr, 1, "Input: %.*s\n", SB_GetLen (Line), SB_GetConstBuf (Line));
+           Print (stderr, 1, "Input: %.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line));
         }
        ++WarningCount;
     }
@@ -126,7 +126,7 @@ static void IntError (const char* Filename, unsigned LineNo, const char* Msg, va
     fprintf (stderr, "\n");
 
     if (Line) {
-        Print (stderr, 1, "Input: %.*s\n", SB_GetLen (Line), SB_GetConstBuf (Line));
+        Print (stderr, 1, "Input: %.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line));
     }
     ++ErrorCount;
     if (ErrorCount > 10) {
@@ -192,7 +192,7 @@ void Fatal (const char* Format, ...)
     fprintf (stderr, "\n");
 
     if (Line) {
-        Print (stderr, 1, "Input: %.*s\n", SB_GetLen (Line), SB_GetConstBuf (Line));
+        Print (stderr, 1, "Input: %.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line));
     }
     exit (EXIT_FAILURE);
 }
@@ -223,7 +223,7 @@ void Internal (const char* Format, ...)
     fprintf (stderr, "\n");
 
     if (Line) {
-        fprintf (stderr, "\nInput: %.*s\n", SB_GetLen (Line), SB_GetConstBuf (Line));
+        fprintf (stderr, "\nInput: %.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line));
     }
 
     /* Use abort to create a core dump */
index 77720a710095678db7f7746c33b2465293180454..1b13018bc3a623e5cf4fde505edb38df5f4f8f53 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2008, Ullrich von Bassewitz                                      */
+/* (C) 1998-2009, Ullrich von Bassewitz                                      */
 /*                Roemerstrasse 52                                           */
 /*                D-70794 Filderstadt                                        */
 /* EMail:         uz@cc65.org                                                */
@@ -1387,7 +1387,7 @@ void Preprocess (void)
 Done:
     if (Verbosity > 1 && SB_NotEmpty (Line)) {
         printf ("%s(%u): %.*s\n", GetCurrentFile (), GetCurrentLine (),
-                SB_GetLen (Line), SB_GetConstBuf (Line));
+                (int) SB_GetLen (Line), SB_GetConstBuf (Line));
     }
 }
 
index 49fd291d5a0932e3d3bc90081f6d4f6ce79db6dd..74ceb6742c4a9137aa885d78ee3859d0b9644473 100644 (file)
@@ -1037,7 +1037,7 @@ int Consume (token_t Token, const char* ErrorMsg)
        NextToken ();
         return 1;
     } else {
-               Error (ErrorMsg);
+               Error ("%s", ErrorMsg);
         return 0;
     }
 }
index 977971b01a98b1ad967f4cd56cd837323c991059..1f5a61ea4b785a00c424ff647accdb2debf0bfd7 100644 (file)
@@ -91,7 +91,7 @@ static void CheckTok (token_t Tok, const char* Msg, int* PendingToken)
  */
 {
     if (CurTok.Tok != Tok) {
-       Error (Msg);
+       Error ("%s", Msg);
     } else if (PendingToken) {
        *PendingToken = 1;
     } else {
index f7412ff7780e0de56412bc2f858c16bee778f8b9..3b73a01ccc663aba950a113574b4aa69d287482e 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000-2004 Ullrich von Bassewitz                                       */
-/*               Römerstrasse 52                                             */
-/*               D-70794 Filderstadt                                         */
-/* EMail:        uz@cc65.org                                                 */
+/* (C) 2000-2009, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -80,7 +80,7 @@ static void OneLine (const OpcDesc* D, const char* Arg, ...)
     xvsprintf (Buf, sizeof (Buf), Arg, ap);
     va_end (ap);
     Indent (ACol);
-    Output (Buf);
+    Output ("%s", Buf);
 
     /* Add the code stuff as comment */
     LineComment (PC, D->Size);
index f2649e40548cd42a58aeada6e79599c09610f810..35a7addf9ae2b66c0789b8993624cff95f35e795 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2008, Ullrich von Bassewitz                                      */
+/* (C) 1998-2009, Ullrich von Bassewitz                                      */
 /*                Roemerstrasse 52                                           */
 /*                D-70794 Filderstadt                                        */
 /* EMail:         uz@cc65.org                                                */
@@ -360,7 +360,7 @@ void CfgConsume (cfgtok_t T, const char* Msg)
 /* Skip a token, print an error message if not found */
 {
     if (CfgTok != T) {
-               CfgError (Msg);
+               CfgError ("%s", Msg);
     }
     CfgNextTok ();
 }
index 208c4bfbced706729d9211dc92495e43f471a528..2db9b964d096069310eacc186d761c3fd48eddd4 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2002-2003 Ullrich von Bassewitz                                       */
-/*               Römerstrasse 52                                             */
-/*               D-70794 Filderstadt                                         */
-/* EMail:        uz@cc65.org                                                 */
+/* (C) 2002-2009, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -317,7 +317,7 @@ void DumpObjOptions (FILE* F, unsigned long Offset)
            case OPT_ARGSTR:
                ArgStr = GetString (&StrPool, Val);
                ArgLen = strlen (ArgStr);
-               printf ("      Data:%*s\"%s\"\n", 24-ArgLen, "", ArgStr);
+               printf ("      Data:%*s\"%s\"\n", (int)(24-ArgLen), "", ArgStr);
                break;
 
            case OPT_ARGNUM:
@@ -383,7 +383,7 @@ void DumpObjFiles (FILE* F, unsigned long Offset)
        printf ("    Index:%27u\n", I);
 
        /* Print the data */
-       printf ("      Name:%*s\"%s\"\n", 24-Len, "", Name);
+       printf ("      Name:%*s\"%s\"\n", (int)(24-Len), "", Name);
                printf ("      Size:%26lu\n", Size);
        printf ("      Modification time:%13lu  (%s)\n", MTime, TimeToStr (MTime));
     }
@@ -437,7 +437,7 @@ void DumpObjSegments (FILE* F, unsigned long Offset)
        printf ("    Index:%27u\n", I);
 
        /* Print the data */
-       printf ("      Name:%*s\"%s\"\n", 24-Len, "", Name);
+       printf ("      Name:%*s\"%s\"\n", (int)(24-Len), "", Name);
                printf ("      Size:%26lu\n", Size);
        printf ("      Alignment:%21u\n", Align);
        printf ("      Address size:%14s0x%02X  (%s)\n", "", AddrSize,
@@ -496,7 +496,7 @@ void DumpObjImports (FILE* F, unsigned long Offset)
        /* Print the data */
        printf ("      Address size:%14s0x%02X  (%s)\n", "", AddrSize,
                 AddrSizeToStr (AddrSize));
-       printf ("      Name:%*s\"%s\"\n", 24-Len, "", Name);
+       printf ("      Name:%*s\"%s\"\n", (int)(24-Len), "", Name);
     }
 
     /* Destroy the string pool */
@@ -564,7 +564,7 @@ void DumpObjExports (FILE* F, unsigned long Offset)
                printf ("      Type:%22s0x%02X  (%s)\n", "", Type, GetExportFlags (Type, ConDes));
        printf ("      Address size:%14s0x%02X  (%s)\n", "", AddrSize,
                 AddrSizeToStr (AddrSize));
-       printf ("      Name:%*s\"%s\"\n", 24-Len, "", Name);
+       printf ("      Name:%*s\"%s\"\n", (int)(24-Len), "", Name);
        if (HaveValue) {
            printf ("      Value:%15s0x%08lX  (%lu)\n", "", Value, Value);
        }
@@ -637,7 +637,7 @@ void DumpObjDbgSyms (FILE* F, unsigned long Offset)
                printf ("      Type:%22s0x%02X  (%s)\n", "", Type, GetExportFlags (Type, 0));
        printf ("      Address size:%14s0x%02X  (%s)\n", "", AddrSize,
                 AddrSizeToStr (AddrSize));
-       printf ("      Name:%*s\"%s\"\n", 24-Len, "", Name);
+       printf ("      Name:%*s\"%s\"\n", (int)(24-Len), "", Name);
        if (HaveValue) {
            printf ("      Value:%15s0x%08lX  (%lu)\n", "", Value, Value);
        }
@@ -745,7 +745,7 @@ void DumpObjSegSize (FILE* F, unsigned long Offset)
         (void) ReadVar (F);
 
        /* Print the size for this segment */
-       printf ("    %s:%*s%6lu\n", Name, 24-Len, "", Size);
+       printf ("    %s:%*s%6lu\n", Name, (int)(24-Len), "", Size);
 
         /* Seek to the end of the segment data (start of next) */
         FileSetPos (F, NextSeg);