1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00

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 */
/* 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;

View 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);
}
}

View 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 ();
}

View 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);

View 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));
}

View 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 */

View 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 */

View 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 */

View 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));
}
}

View File

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

View 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 {

View 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);

View 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 ();
}

View 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);