From: cuz Date: Thu, 8 Jun 2000 21:11:48 +0000 (+0000) Subject: Fix several VC++ warnings X-Git-Tag: V2.12.0~3472 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f24375b241ab9580226e299d5e5b65fe44e4aad9;p=cc65 Fix several VC++ warnings git-svn-id: svn://svn.cc65.org/cc65/trunk@40 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/codegen.c b/src/cc65/codegen.c index 7fe2c031a..7b436256a 100644 --- a/src/cc65/codegen.c +++ b/src/cc65/codegen.c @@ -35,7 +35,13 @@ int oursp = 0; /* Current segment */ -static enum { SEG_CODE, SEG_RODATA, SEG_DATA, SEG_BSS } CurSeg = SEG_CODE; +static enum { + SEG_INV = -1, /* Invalid segment */ + SEG_CODE, + SEG_RODATA, + SEG_DATA, + SEG_BSS +} CurSeg = SEG_CODE; /* Segment names */ static char* SegmentNames [4]; @@ -173,7 +179,7 @@ void g_postamble (void) -static void UseSeg (unsigned NewSeg) +static void UseSeg (int NewSeg) /* Switch to a specific segment */ { if (CurSeg != NewSeg) { @@ -217,7 +223,7 @@ void g_usebss (void) -void SegName (unsigned Seg, const char* Name) +static void SegName (int Seg, const char* Name) /* Set the name of a segment */ { /* Free the old name and set a new one */ @@ -228,7 +234,7 @@ void SegName (unsigned Seg, const char* Name) * with the new name. */ if (Seg == CurSeg) { - CurSeg = -1; /* Invalidate */ + CurSeg = SEG_INV; /* Invalidate */ UseSeg (Seg); } } @@ -438,7 +444,7 @@ static int funcargs; void g_enter (unsigned flags, unsigned argsize) -/* Function prologue */ +/* Function prologue */ { if ((flags & CF_FIXARGC) != 0) { /* Just remember the argument size for the leave */ @@ -2219,9 +2225,9 @@ void g_push (unsigned flags, unsigned long val) } else { /* Handle as 16 bit value */ - hi = val >> 8; + hi = (unsigned char) (val >> 8); if (val <= 7) { - AddCodeLine ("\tjsr\tpush%u", val); + AddCodeLine ("\tjsr\tpush%u", (unsigned) val); } else if (hi == 0 || hi == 0xFF) { /* Use special function */ ldaconst (val); diff --git a/src/cc65/include.c b/src/cc65/include.c index e5d798e39..8f7a35942 100644 --- a/src/cc65/include.c +++ b/src/cc65/include.c @@ -73,7 +73,6 @@ static char* Find (const char* Path, const char* File) */ { const char* P; - unsigned Count; int Max; char PathName [FILENAME_MAX]; @@ -92,7 +91,7 @@ static char* Find (const char* Path, const char* File) /* Start the search */ while (*P) { /* Copy the next path element into the buffer */ - Count = 0; + int Count = 0; while (*P != '\0' && *P != ';' && Count < Max) { PathName [Count++] = *P++; } diff --git a/src/cc65/locals.c b/src/cc65/locals.c index 63b6b8611..315194295 100644 --- a/src/cc65/locals.c +++ b/src/cc65/locals.c @@ -54,7 +54,7 @@ /* Register variable management */ unsigned MaxRegSpace = 6; /* Maximum space available */ -static int RegOffs = 0; /* Offset into register space */ +static unsigned RegOffs = 0; /* Offset into register space */ static const SymEntry** RegSyms = 0; /* The register variables */ static unsigned RegSymCount = 0; /* Number of register variables */ @@ -407,7 +407,8 @@ void RestoreRegVars (int HaveResult) * the accumulator must be saved across the restore. */ { - int I, J, Bytes, Offs; + unsigned I, J; + int Bytes, Offs; /* If we don't have register variables in this function, bail out early */ if (RegSymCount == 0) { @@ -465,5 +466,5 @@ void RestoreRegVars (int HaveResult) } } - + diff --git a/src/cc65/mem.c b/src/cc65/mem.c index 72b2291cc..13e643b8a 100644 --- a/src/cc65/mem.c +++ b/src/cc65/mem.c @@ -26,7 +26,7 @@ #include #include #include -#ifdef __WATCOMC__ +#if defined(__WATCOMC__) || defined(_MSC_VER) # include #endif diff --git a/src/cc65/pragma.c b/src/cc65/pragma.c index 2a0f7460c..b1fbc1f40 100644 --- a/src/cc65/pragma.c +++ b/src/cc65/pragma.c @@ -106,7 +106,7 @@ static void FlagPragma (unsigned char* Flag) constexpr (&val); /* Store the value into the flag parameter */ - *Flag = val.e_const; + *Flag = (val.e_const != 0); } @@ -116,14 +116,14 @@ void DoPragma (void) { static const struct tok_elt Pragmas [] = { { "bssseg", PR_BSSSEG }, - { "codeseg", PR_CODESEG }, - { "dataseg", PR_DATASEG }, - { "regvaraddr", PR_REGVARADDR }, - { "rodataseg", PR_RODATASEG }, + { "codeseg", PR_CODESEG }, + { "dataseg", PR_DATASEG }, + { "regvaraddr", PR_REGVARADDR }, + { "rodataseg", PR_RODATASEG }, { "signedchars", PR_SIGNEDCHARS }, { "staticlocals", PR_STATICLOCALS }, { "zpsym", PR_ZPSYM }, - { 0, PR_ILLEGAL }, + { 0, PR_ILLEGAL }, }; int Pragma;