Fix several VC++ warnings

git-svn-id: svn://svn.cc65.org/cc65/trunk@40 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2000-06-08 21:11:48 +00:00
parent 048930265c
commit f24375b241
5 changed files with 25 additions and 19 deletions

View File

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

View File

@ -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++;
}

View File

@ -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)
}
}

View File

@ -26,7 +26,7 @@
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#ifdef __WATCOMC__
#if defined(__WATCOMC__) || defined(_MSC_VER)
# include <malloc.h>
#endif

View File

@ -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;