Fixed warnings generated by clang (run by Per Olofsson).

git-svn-id: svn://svn.cc65.org/cc65/trunk@4255 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2009-09-28 15:59:18 +00:00
parent de7a7fe271
commit 85f96a7d6f
14 changed files with 64 additions and 60 deletions

View File

@@ -6,10 +6,10 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 2000-2008 Ullrich von Bassewitz */ /* (C) 2000-2009, Ullrich von Bassewitz */
/* Roemerstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* 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 /* Print the header for a new page. It is assumed that the given line is the
* last line of the previous page. * last line of the previous page.
*/ */
{ {
/* Gte a pointer to the current input file */ /* Gte a pointer to the current input file */
const StrBuf* CurFile = GetFileName (L->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, VER_MAJOR, VER_MINOR, VER_PATCH,
Copyright, Copyright,
InFile, InFile,
SB_GetLen (CurFile), SB_GetConstBuf (CurFile)); (int) SB_GetLen (CurFile), SB_GetConstBuf (CurFile));
/* Count pages, reset lines */ /* Count pages, reset lines */
++PageNumber; ++PageNumber;

View File

@@ -6,10 +6,10 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 2000-2008 Ullrich von Bassewitz */ /* (C) 2000-2009, Ullrich von Bassewitz */
/* Roemerstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* 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) { if (Tok == Expected) {
NextTok (); NextTok ();
} else { } else {
Error (ErrMsg); Error ("%s", ErrMsg);
} }
} }

View File

@@ -6,7 +6,7 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 1998-2008, Ullrich von Bassewitz */ /* (C) 1998-2009, Ullrich von Bassewitz */
/* Roemerstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* 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 /* 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. * 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); fflush (stdout);
NextTok (); NextTok ();
} }

View File

@@ -1373,6 +1373,7 @@ void CE_Output (const CodeEntry* E)
{ {
const OPCDesc* D; const OPCDesc* D;
unsigned Chars; unsigned Chars;
int Space;
const char* Target; const char* Target;
/* If we have a label, print that */ /* If we have a label, print that */
@@ -1387,6 +1388,9 @@ void CE_Output (const CodeEntry* E)
/* Print the mnemonic */ /* Print the mnemonic */
Chars = WriteOutput ("\t%s", D->Mnemo); Chars = WriteOutput ("\t%s", D->Mnemo);
/* Space to leave before the operand */
Space = 9 - Chars;
/* Print the operand */ /* Print the operand */
switch (E->AM) { switch (E->AM) {
@@ -1397,50 +1401,50 @@ void CE_Output (const CodeEntry* E)
case AM65_ACC: case AM65_ACC:
/* accumulator */ /* accumulator */
Chars += WriteOutput ("%*sa", 9-Chars, ""); Chars += WriteOutput ("%*sa", Space, "");
break; break;
case AM65_IMM: case AM65_IMM:
/* immidiate */ /* immidiate */
Chars += WriteOutput ("%*s#%s", 9-Chars, "", E->Arg); Chars += WriteOutput ("%*s#%s", Space, "", E->Arg);
break; break;
case AM65_ZP: case AM65_ZP:
case AM65_ABS: case AM65_ABS:
/* zeropage and absolute */ /* zeropage and absolute */
Chars += WriteOutput ("%*s%s", 9-Chars, "", E->Arg); Chars += WriteOutput ("%*s%s", Space, "", E->Arg);
break; break;
case AM65_ZPX: case AM65_ZPX:
case AM65_ABSX: case AM65_ABSX:
/* zeropage,X and absolute,X */ /* zeropage,X and absolute,X */
Chars += WriteOutput ("%*s%s,x", 9-Chars, "", E->Arg); Chars += WriteOutput ("%*s%s,x", Space, "", E->Arg);
break; break;
case AM65_ABSY: case AM65_ABSY:
/* absolute,Y */ /* absolute,Y */
Chars += WriteOutput ("%*s%s,y", 9-Chars, "", E->Arg); Chars += WriteOutput ("%*s%s,y", Space, "", E->Arg);
break; break;
case AM65_ZPX_IND: case AM65_ZPX_IND:
/* (zeropage,x) */ /* (zeropage,x) */
Chars += WriteOutput ("%*s(%s,x)", 9-Chars, "", E->Arg); Chars += WriteOutput ("%*s(%s,x)", Space, "", E->Arg);
break; break;
case AM65_ZP_INDY: case AM65_ZP_INDY:
/* (zeropage),y */ /* (zeropage),y */
Chars += WriteOutput ("%*s(%s),y", 9-Chars, "", E->Arg); Chars += WriteOutput ("%*s(%s),y", Space, "", E->Arg);
break; break;
case AM65_ZP_IND: case AM65_ZP_IND:
/* (zeropage) */ /* (zeropage) */
Chars += WriteOutput ("%*s(%s)", 9-Chars, "", E->Arg); Chars += WriteOutput ("%*s(%s)", Space, "", E->Arg);
break; break;
case AM65_BRA: case AM65_BRA:
/* branch */ /* branch */
Target = E->JumpTo? E->JumpTo->Name : E->Arg; Target = E->JumpTo? E->JumpTo->Name : E->Arg;
Chars += WriteOutput ("%*s%s", 9-Chars, "", Target); Chars += WriteOutput ("%*s%s", Space, "", Target);
break; break;
default: default:
@@ -1449,11 +1453,11 @@ void CE_Output (const CodeEntry* E)
} }
/* Print usage info if requested by the debugging flag */ /* Print usage info if requested by the debugging flag */
if (Debug) { if (Debug) {
char Use [128]; char Use [128];
char Chg [128]; char Chg [128];
WriteOutput ("%*s; USE: %-12s CHG: %-12s SIZE: %u", WriteOutput ("%*s; USE: %-12s CHG: %-12s SIZE: %u",
30-Chars, "", (int)(30-Chars), "",
RegInfoDesc (E->Use, Use), RegInfoDesc (E->Use, Use),
RegInfoDesc (E->Chg, Chg), RegInfoDesc (E->Chg, Chg),
E->Size); E->Size);

View File

@@ -929,7 +929,7 @@ void g_getind (unsigned Flags, unsigned Offs)
void g_leasp (int Offs) void g_leasp (int Offs)
/* Fetch the address of the specified symbol into the primary register */ /* 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 */ /* Calculate the offset relative to sp */
Offs -= StackPtr; Offs -= StackPtr;
@@ -4230,7 +4230,7 @@ void g_defbytes (const void* Bytes, unsigned Count)
} while (Chunk); } while (Chunk);
/* Output the line */ /* 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) void g_asmcode (struct StrBuf* B)
/* Output one line of assembler code. */ /* Output one line of assembler code. */
{ {
AddCodeLine ("%.*s", SB_GetLen (B), SB_GetConstBuf (B)); AddCodeLine ("%.*s", (int) SB_GetLen (B), SB_GetConstBuf (B));
} }

View File

@@ -1079,7 +1079,7 @@ void CS_DelCodeRange (CodeSeg* S, unsigned First, unsigned Last)
if (CE_HasLabel (FirstEntry)) { if (CE_HasLabel (FirstEntry)) {
/* Get the entry following last */ /* Get the entry following last */
CodeEntry* FollowingEntry = CS_GetNextEntry (S, Last); CodeEntry* FollowingEntry = CS_GetNextEntry (S, Last);
if (FollowingEntry) { if (FollowingEntry) {
/* There is an entry after Last - move the labels */ /* There is an entry after Last - move the labels */
CS_MoveLabels (S, FirstEntry, FollowingEntry); CS_MoveLabels (S, FirstEntry, FollowingEntry);
} else { } else {
@@ -1395,7 +1395,7 @@ void CS_Output (CodeSeg* S)
const char* N = strchr (L, '\n'); const char* N = strchr (L, '\n');
if (N) { if (N) {
/* We have a newline, just write the first part */ /* 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; L = N+1;
} else { } else {
/* No Newline, write as is */ /* No Newline, write as is */

View File

@@ -356,7 +356,7 @@ void Compile (const char* FileName)
/* Preprocess each line and write it to the output file */ /* Preprocess each line and write it to the output file */
while (NextLine ()) { while (NextLine ()) {
Preprocess (); Preprocess ();
WriteOutput ("%.*s\n", SB_GetLen (Line), SB_GetConstBuf (Line)); WriteOutput ("%.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line));
} }
/* Close the output file */ /* Close the output file */

View File

@@ -6,10 +6,10 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 1998-2004 Ullrich von Bassewitz */ /* (C) 1998-2009, Ullrich von Bassewitz */
/* R<EFBFBD>merstra<EFBFBD>e 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* 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"); fprintf (stderr, "\n");
if (Line) { 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; ++WarningCount;
} }
@@ -126,7 +126,7 @@ static void IntError (const char* Filename, unsigned LineNo, const char* Msg, va
fprintf (stderr, "\n"); fprintf (stderr, "\n");
if (Line) { 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; ++ErrorCount;
if (ErrorCount > 10) { if (ErrorCount > 10) {
@@ -192,7 +192,7 @@ void Fatal (const char* Format, ...)
fprintf (stderr, "\n"); fprintf (stderr, "\n");
if (Line) { 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); exit (EXIT_FAILURE);
} }
@@ -223,7 +223,7 @@ void Internal (const char* Format, ...)
fprintf (stderr, "\n"); fprintf (stderr, "\n");
if (Line) { 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 */ /* Use abort to create a core dump */

View File

@@ -6,7 +6,7 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 1998-2008, Ullrich von Bassewitz */ /* (C) 1998-2009, Ullrich von Bassewitz */
/* Roemerstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
@@ -1387,7 +1387,7 @@ void Preprocess (void)
Done: Done:
if (Verbosity > 1 && SB_NotEmpty (Line)) { if (Verbosity > 1 && SB_NotEmpty (Line)) {
printf ("%s(%u): %.*s\n", GetCurrentFile (), GetCurrentLine (), printf ("%s(%u): %.*s\n", GetCurrentFile (), GetCurrentLine (),
SB_GetLen (Line), SB_GetConstBuf (Line)); (int) SB_GetLen (Line), SB_GetConstBuf (Line));
} }
} }

View File

@@ -1037,7 +1037,7 @@ int Consume (token_t Token, const char* ErrorMsg)
NextToken (); NextToken ();
return 1; return 1;
} else { } else {
Error (ErrorMsg); Error ("%s", ErrorMsg);
return 0; return 0;
} }
} }

View File

@@ -91,7 +91,7 @@ static void CheckTok (token_t Tok, const char* Msg, int* PendingToken)
*/ */
{ {
if (CurTok.Tok != Tok) { if (CurTok.Tok != Tok) {
Error (Msg); Error ("%s", Msg);
} else if (PendingToken) { } else if (PendingToken) {
*PendingToken = 1; *PendingToken = 1;
} else { } else {

View File

@@ -6,10 +6,10 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 2000-2004 Ullrich von Bassewitz */ /* (C) 2000-2009, Ullrich von Bassewitz */
/* R<EFBFBD>merstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* 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); xvsprintf (Buf, sizeof (Buf), Arg, ap);
va_end (ap); va_end (ap);
Indent (ACol); Indent (ACol);
Output (Buf); Output ("%s", Buf);
/* Add the code stuff as comment */ /* Add the code stuff as comment */
LineComment (PC, D->Size); LineComment (PC, D->Size);

View File

@@ -6,7 +6,7 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 1998-2008, Ullrich von Bassewitz */ /* (C) 1998-2009, Ullrich von Bassewitz */
/* Roemerstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* 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 */ /* Skip a token, print an error message if not found */
{ {
if (CfgTok != T) { if (CfgTok != T) {
CfgError (Msg); CfgError ("%s", Msg);
} }
CfgNextTok (); CfgNextTok ();
} }

View File

@@ -6,10 +6,10 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 2002-2003 Ullrich von Bassewitz */ /* (C) 2002-2009, Ullrich von Bassewitz */
/* R<EFBFBD>merstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* 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: case OPT_ARGSTR:
ArgStr = GetString (&StrPool, Val); ArgStr = GetString (&StrPool, Val);
ArgLen = strlen (ArgStr); ArgLen = strlen (ArgStr);
printf (" Data:%*s\"%s\"\n", 24-ArgLen, "", ArgStr); printf (" Data:%*s\"%s\"\n", (int)(24-ArgLen), "", ArgStr);
break; break;
case OPT_ARGNUM: case OPT_ARGNUM:
@@ -383,7 +383,7 @@ void DumpObjFiles (FILE* F, unsigned long Offset)
printf (" Index:%27u\n", I); printf (" Index:%27u\n", I);
/* Print the data */ /* 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 (" Size:%26lu\n", Size);
printf (" Modification time:%13lu (%s)\n", MTime, TimeToStr (MTime)); 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); printf (" Index:%27u\n", I);
/* Print the data */ /* 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 (" Size:%26lu\n", Size);
printf (" Alignment:%21u\n", Align); printf (" Alignment:%21u\n", Align);
printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize, printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize,
@@ -496,7 +496,7 @@ void DumpObjImports (FILE* F, unsigned long Offset)
/* Print the data */ /* Print the data */
printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize, printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize,
AddrSizeToStr (AddrSize)); AddrSizeToStr (AddrSize));
printf (" Name:%*s\"%s\"\n", 24-Len, "", Name); printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name);
} }
/* Destroy the string pool */ /* 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 (" Type:%22s0x%02X (%s)\n", "", Type, GetExportFlags (Type, ConDes));
printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize, printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize,
AddrSizeToStr (AddrSize)); AddrSizeToStr (AddrSize));
printf (" Name:%*s\"%s\"\n", 24-Len, "", Name); printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name);
if (HaveValue) { if (HaveValue) {
printf (" Value:%15s0x%08lX (%lu)\n", "", Value, Value); 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 (" Type:%22s0x%02X (%s)\n", "", Type, GetExportFlags (Type, 0));
printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize, printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize,
AddrSizeToStr (AddrSize)); AddrSizeToStr (AddrSize));
printf (" Name:%*s\"%s\"\n", 24-Len, "", Name); printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name);
if (HaveValue) { if (HaveValue) {
printf (" Value:%15s0x%08lX (%lu)\n", "", Value, Value); printf (" Value:%15s0x%08lX (%lu)\n", "", Value, Value);
} }
@@ -745,7 +745,7 @@ void DumpObjSegSize (FILE* F, unsigned long Offset)
(void) ReadVar (F); (void) ReadVar (F);
/* Print the size for this segment */ /* 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) */ /* Seek to the end of the segment data (start of next) */
FileSetPos (F, NextSeg); FileSetPos (F, NextSeg);