From d0e08654a8100006948e3260646b7517060c5f9c Mon Sep 17 00:00:00 2001 From: bernhardheld Date: Thu, 6 Mar 2003 12:02:45 +0000 Subject: [PATCH] fix 64 bit warnings git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2336 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 10 +++++++++- src/SDCChasht.c | 2 +- src/SDCCsymt.c | 2 +- src/pic/pcode.c | 10 +++++----- support/regression/tests/malloc.c | 12 ++++++++++++ 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8bfb2cb7..03065d47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,12 @@ -2003-02-26 Bernhard Held +2003-03-06 Bernhard Held + + * src/pic/pcode.c (get_op): fix 64 bit warnings + * src/pic/pcode.c (pCode2str): fix 64 bit warnings + * src/SDCChasht.c (newHashTable): fix 64 bit warnings + * src/SDCCsymt.c (checkTypeSanity): fix 64 bit warnings + * support/regression/tests/malloc.c: fix 64 bit warnings + +2003-03-04 Bernhard Held * src/mcs51/gen.c (genMinus): fixed bug 696436 diff --git a/src/SDCChasht.c b/src/SDCChasht.c index d7551c04..07aa2ec5 100644 --- a/src/SDCChasht.c +++ b/src/SDCChasht.c @@ -62,7 +62,7 @@ newHashTable (int size) if (!(htab->table = Safe_alloc ((size + 1) * sizeof (hashtItem *)))) { fprintf (stderr, "out of virtual memory %s %d\n", - __FILE__, (size + 1) * sizeof (hashtItem *)); + __FILE__, (size + 1) * (int) sizeof (hashtItem *)); exit (1); } htab->minKey = htab->size = size; diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index cebe16c5..73a08b84 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -508,7 +508,7 @@ void checkTypeSanity(sym_link *etype, char *name) { noun=nounName(etype); if (getenv("DEBUG_SANITY")) { - fprintf (stderr, "checking sanity for %s %x\n", name, (int)etype); + fprintf (stderr, "checking sanity for %s %p\n", name, etype); } if ((SPEC_NOUN(etype)==V_CHAR || diff --git a/src/pic/pcode.c b/src/pic/pcode.c index bcec3494..f675769e 100644 --- a/src/pic/pcode.c +++ b/src/pic/pcode.c @@ -105,7 +105,7 @@ static void pCodePrintLabel(FILE *of, pCode *pc); static void pCodePrintFunction(FILE *of, pCode *pc); static void pCodeOpPrint(FILE *of, pCodeOp *pcop); static char *get_op_from_instruction( pCodeInstruction *pcc); -char *get_op( pCodeOp *pcop,char *buff,int buf_size); +char *get_op( pCodeOp *pcop,char *buff,size_t buf_size); int pCodePeepMatchLine(pCodePeep *peepBlock, pCode *pcs, pCode *pcd); int pCodePeepMatchRule(pCode *pc); void pBlockStats(FILE *of, pBlock *pb); @@ -1228,7 +1228,7 @@ void SAFE_snprintf(char **str, size_t *size, const char *format, ...) len = strlen(*str); if(len > *size) { fprintf(stderr,"WARNING, it looks like %s has overflowed\n",__FUNCTION__); - fprintf(stderr,"len = %d is > str size %d\n",len,*size); + fprintf(stderr,"len = %d is > str size %d\n",len,(int)*size); } *str += len; @@ -2490,7 +2490,7 @@ void pBlockRegs(FILE *of, pBlock *pb) /*-----------------------------------------------------------------*/ /*-----------------------------------------------------------------*/ -char *get_op(pCodeOp *pcop,char *buffer, int size) +char *get_op(pCodeOp *pcop,char *buffer, size_t size) { regs *r; static char b[50]; @@ -2587,7 +2587,7 @@ static char *get_op_from_instruction( pCodeInstruction *pcc) if(pcc ) return get_op(pcc->pcop,NULL,0); - + /* gcc 3.2: warning: concatenation of string literals with __FUNCTION__ is deprecated return ("ERROR Null: "__FUNCTION__); */ @@ -2605,7 +2605,7 @@ static void pCodeOpPrint(FILE *of, pCodeOp *pcop) /*-----------------------------------------------------------------*/ /*-----------------------------------------------------------------*/ -char *pCode2str(char *str, int size, pCode *pc) +char *pCode2str(char *str, size_t size, pCode *pc) { char *s = str; diff --git a/support/regression/tests/malloc.c b/support/regression/tests/malloc.c index 21e1975f..91656c4c 100644 --- a/support/regression/tests/malloc.c +++ b/support/regression/tests/malloc.c @@ -23,15 +23,27 @@ testMalloc(void) p1 = malloc(5); ASSERT(p1 != NULL); +#ifdef HOST + LOG(("p1: %p\n", p1)); +#else LOG(("p1: %u\n", (unsigned) p1)); +#endif p2 = malloc(20); ASSERT(p2 != NULL); +#ifdef HOST + LOG(("p2: %p\n", p2)); +#else LOG(("p2: %u\n", (unsigned) p2)); +#endif free(p2); p3 = malloc(10); ASSERT(p3 != NULL); +#ifdef HOST + LOG(("p3, after freeing p2: %p\n", p3)); +#else LOG(("p3, after freeing p2: %u\n", (unsigned) p3)); +#endif } -- 2.39.5