From: cuz Date: Sat, 15 Sep 2001 13:36:59 +0000 (+0000) Subject: Fixed a few warnings X-Git-Tag: V2.12.0~2645 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1a65e30fa097a421a3d6a3f5b30c38846e822e15;p=cc65 Fixed a few warnings git-svn-id: svn://svn.cc65.org/cc65/trunk@938 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/da65/code.c b/src/da65/code.c index 3e58dea54..210bb26e9 100644 --- a/src/da65/code.c +++ b/src/da65/code.c @@ -68,8 +68,7 @@ unsigned long PC; /* Current PC */ void LoadCode (const char* Name, unsigned long StartAddress) /* Load the code from the given file */ { - unsigned Count, MaxCount; - long Size; + long Count, MaxCount, Size; FILE* F; diff --git a/src/da65/global.c b/src/da65/global.c index d3e36dc9d..f1052c58a 100644 --- a/src/da65/global.c +++ b/src/da65/global.c @@ -60,7 +60,7 @@ unsigned long StartAddr = 0xC000; /* Start/load address of the program */ unsigned char Pass = 0; /* Disassembler pass */ /* Page formatting */ -int PageLength = -1; /* Length of a listing page */ +unsigned PageLength = 0; /* Length of a listing page */ unsigned MIndent = 9; /* Mnemonic indent */ unsigned AIndent = 17; /* Argument indent */ unsigned CIndent = 49; /* Comment indent */ diff --git a/src/da65/global.h b/src/da65/global.h index 7ebd28dac..4c2b10663 100644 --- a/src/da65/global.h +++ b/src/da65/global.h @@ -64,7 +64,7 @@ extern unsigned char Pass; /* Disassembler pass */ /* Page formatting */ #define MIN_PAGE_LEN 32 #define MAX_PAGE_LEN 127 -extern int PageLength; /* Length of a listing page */ +extern unsigned PageLength; /* Length of a listing page */ extern unsigned MIndent; /* Mnemonic indent */ extern unsigned AIndent; /* Argument indent */ extern unsigned CIndent; /* Comment indent */ diff --git a/src/da65/main.c b/src/da65/main.c index 916afbdfb..761b11eed 100644 --- a/src/da65/main.c +++ b/src/da65/main.c @@ -168,7 +168,7 @@ static void OptPageLength (const char* Opt, const char* Arg) NeedArg (Opt); } Len = atoi (Arg); - if (Len != -1 && (Len < MIN_PAGE_LEN || Len > MAX_PAGE_LEN)) { + if (Len != 0 && (Len < MIN_PAGE_LEN || Len > MAX_PAGE_LEN)) { AbEnd ("Invalid page length: %d", Len); } PageLength = Len; @@ -323,7 +323,7 @@ int main (int argc, char* argv []) { "--version", 0, OptVersion }, }; - int I; + unsigned I; /* Initialize the cmdline module */ InitCmdLine (&argc, &argv, "da65"); diff --git a/src/da65/make/gcc.mak b/src/da65/make/gcc.mak index 37b8aced2..fa6c4a1e5 100644 --- a/src/da65/make/gcc.mak +++ b/src/da65/make/gcc.mak @@ -5,7 +5,7 @@ # Library dir COMMON = ../common -CFLAGS = -g -O2 -Wall -I$(COMMON) +CFLAGS = -g -O2 -Wall -W -Wno-unused-parameter -I$(COMMON) CC=gcc EBIND=emxbind LDFLAGS= diff --git a/src/da65/output.c b/src/da65/output.c index 985fd4ac2..df21f03a3 100644 --- a/src/da65/output.c +++ b/src/da65/output.c @@ -138,7 +138,7 @@ void Indent (unsigned N) void LineFeed (void) /* Add a linefeed to the output file */ { - if (Pass == PassCount) { + if (Pass == PassCount && PageLength > 0) { fputc ('\n', F); if (++Line >= PageLength) { if (FormFeeds) { diff --git a/src/da65/scanner.c b/src/da65/scanner.c index 8a03b0c7f..19f5dad86 100644 --- a/src/da65/scanner.c +++ b/src/da65/scanner.c @@ -58,7 +58,7 @@ /* Current token and attributes */ unsigned CfgTok; char CfgSVal [CFG_MAX_IDENT_LEN+1]; -unsigned long CfgIVal; +long CfgIVal; /* Error location */ unsigned CfgErrorLine; @@ -90,7 +90,7 @@ void CfgWarning (const char* Format, ...) va_start (ap, Format); xvsprintf (Buf, sizeof (Buf), Format, ap); - va_end (ap); + va_end (ap); Warning ("%s(%u): %s", CfgFile, CfgErrorLine, Buf); } @@ -109,7 +109,7 @@ void CfgError (const char* Format, ...) Error ("%s(%u): %s", CfgFile, CfgErrorLine, Buf); } - + /*****************************************************************************/ @@ -389,7 +389,7 @@ void CfgAssureIdent (void) -void CfgRangeCheck (unsigned long Lo, unsigned long Hi) +void CfgRangeCheck (long Lo, long Hi) /* Check the range of CfgIVal */ { if (CfgIVal < Lo || CfgIVal > Hi) { diff --git a/src/da65/scanner.h b/src/da65/scanner.h index 51b033386..71e4ea23a 100644 --- a/src/da65/scanner.h +++ b/src/da65/scanner.h @@ -107,7 +107,7 @@ struct IdentTok_ { #define CFG_MAX_IDENT_LEN 255 extern unsigned CfgTok; extern char CfgSVal [CFG_MAX_IDENT_LEN+1]; -extern unsigned long CfgIVal; +extern long CfgIVal; /* Error location */ extern unsigned CfgErrorLine; @@ -160,7 +160,7 @@ void CfgAssureStr (void); void CfgAssureIdent (void); /* Make sure the next token is an identifier */ -void CfgRangeCheck (unsigned long Lo, unsigned long Hi); +void CfgRangeCheck (long Lo, long Hi); /* Check the range of CfgIVal */ void CfgSpecialToken (const IdentTok* Table, unsigned Size, const char* Name); diff --git a/src/grc/grc.c b/src/grc/grc.c index 4bb9d493e..9dd426297 100644 --- a/src/grc/grc.c +++ b/src/grc/grc.c @@ -112,9 +112,9 @@ char *nextWord() { return strtok(NULL, " "); } -void setLen (char *name, int len) { +void setLen (char *name, unsigned len) { if (strlen(name)>len) - name[len]='\0'; + name[len]='\0'; } void fillOut (char *name, int len, char *filler) { diff --git a/src/grc/make/gcc.mak b/src/grc/make/gcc.mak index 472db02d4..2cb36f645 100644 --- a/src/grc/make/gcc.mak +++ b/src/grc/make/gcc.mak @@ -2,7 +2,7 @@ # gcc Makefile for grc # -CFLAGS = -g -O2 -Wall +CFLAGS = -g -O2 -Wall -W CC = gcc LDFLAGS = EBIND = emxbind diff --git a/src/ld65/condes.c b/src/ld65/condes.c index d8446312d..68beb6f78 100644 --- a/src/ld65/condes.c +++ b/src/ld65/condes.c @@ -213,7 +213,7 @@ void ConDesSetSegName (unsigned Type, const char* SegName) /* Set the segment name where the table should go */ { /* Check the parameters */ - PRECONDITION (Type >= CD_TYPE_MIN && Type <= CD_TYPE_MAX && SegName != 0); + PRECONDITION (Type <= CD_TYPE_MAX && SegName != 0); /* Setting the segment name twice is bad */ CHECK (ConDes[Type].SegName == 0); @@ -228,7 +228,7 @@ void ConDesSetLabel (unsigned Type, const char* Name) /* Set the label for the given ConDes type */ { /* Check the parameters */ - PRECONDITION (Type >= CD_TYPE_MIN && Type <= CD_TYPE_MAX && Name != 0); + PRECONDITION (Type <= CD_TYPE_MAX && Name != 0); /* Setting the label twice is bad */ CHECK (ConDes[Type].Label == 0); @@ -243,7 +243,7 @@ void ConDesSetCountSym (unsigned Type, const char* Name) /* Set the name for the given ConDes count symbol */ { /* Check the parameters */ - PRECONDITION (Type >= CD_TYPE_MIN && Type <= CD_TYPE_MAX && Name != 0); + PRECONDITION (Type <= CD_TYPE_MAX && Name != 0); /* Setting the symbol twice is bad */ CHECK (ConDes[Type].CountSym == 0); @@ -258,7 +258,7 @@ void ConDesSetOrder (unsigned Type, ConDesOrder Order) /* Set the sorting oder for the given ConDes table */ { /* Check the parameters */ - PRECONDITION (Type >= CD_TYPE_MIN && Type <= CD_TYPE_MAX); + PRECONDITION (Type <= CD_TYPE_MAX); /* Set the order */ ConDes[Type].Order = Order; @@ -270,7 +270,7 @@ int ConDesHasSegName (unsigned Type) /* Return true if a segment name is already defined for this ConDes type */ { /* Check the parameters */ - PRECONDITION (Type >= CD_TYPE_MIN && Type <= CD_TYPE_MAX); + PRECONDITION (Type <= CD_TYPE_MAX); return (ConDes[Type].SegName != 0); } @@ -281,7 +281,7 @@ int ConDesHasLabel (unsigned Type) /* Return true if a label is already defined for this ConDes type */ { /* Check the parameters */ - PRECONDITION (Type >= CD_TYPE_MIN && Type <= CD_TYPE_MAX); + PRECONDITION (Type <= CD_TYPE_MAX); return (ConDes[Type].Label != 0); } diff --git a/src/ld65/main.c b/src/ld65/main.c index 18f93e84c..e1a046d47 100644 --- a/src/ld65/main.c +++ b/src/ld65/main.c @@ -304,7 +304,7 @@ int main (int argc, char* argv []) { "--version", 0, OptVersion }, }; - int I; + unsigned I; /* Initialize the cmdline module */ InitCmdLine (&argc, &argv, "ld65"); @@ -433,7 +433,7 @@ int main (int argc, char* argv []) } if (LabelFileName) { CreateLabelFile (); - } + } if (DbgFileName) { CreateDbgFile (); } diff --git a/src/ld65/make/gcc.mak b/src/ld65/make/gcc.mak index 0cdcca1f3..a2e4bdd82 100644 --- a/src/ld65/make/gcc.mak +++ b/src/ld65/make/gcc.mak @@ -7,7 +7,7 @@ COMMON = ../common # Default for the compiler lib search path as compiler define CDEFS=-DCC65_LIB=\"/usr/lib/cc65/lib/\" -CFLAGS = -g -O2 -Wall -I$(COMMON) $(CDEFS) +CFLAGS = -g -O2 -Wall -W -Wno-unused-parameter -I$(COMMON) $(CDEFS) CC=gcc EBIND=emxbind LDFLAGS= diff --git a/src/od65/main.c b/src/od65/main.c index 4c194f928..f6d184063 100644 --- a/src/od65/main.c +++ b/src/od65/main.c @@ -265,7 +265,7 @@ int main (int argc, char* argv []) { "--version", 0, OptVersion }, }; - int I; + unsigned I; /* Initialize the cmdline module */ InitCmdLine (&argc, &argv, "od65"); diff --git a/src/od65/make/gcc.mak b/src/od65/make/gcc.mak index ce06f5056..616b82423 100644 --- a/src/od65/make/gcc.mak +++ b/src/od65/make/gcc.mak @@ -6,7 +6,7 @@ # Library dir COMMON = ../common -CFLAGS = -O2 -g -Wall -I$(COMMON) +CFLAGS = -O2 -g -Wall -W -Wno-unused-parameter -I$(COMMON) CC=gcc EBIND=emxbind LDFLAGS=