From: maartenbrock Date: Wed, 6 Apr 2005 20:09:07 +0000 (+0000) Subject: * device/include/stdarg.h: changed SDCC specific keywords to double X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=5ccbbbc1178705e93d55cc06bb8116deb5c4ce33;p=fw%2Fsdcc * device/include/stdarg.h: changed SDCC specific keywords to double underlined form. * device/include/stdint.h: changed intptr_t and uintptr_t for others than mcs51 and ds390. * device/include/hc08/mc68hc908gp32.h, * device/include/hc08/mc68hc908jb8.h, * device/include/hc08/mc68hc908jkjl.h, * device/include/hc08/mc68hc908qy.h: fixed comments * device/include/mcs51/README: updated * device/include/mcs51/c8051f120.h: added PINRSF * device/lib/pic16/libc/stdlib/crc16.c: fixed comments * src/pic16/pcode.c: MSVC6 doesn't accept declaring new variables amidst code. Also inline is not supported. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3721 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 39475beb..a8802cd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2005-04-06 Maarten Brock + + * device/include/stdarg.h: changed SDCC specific keywords to double + underlined form. + * device/include/stdint.h: changed intptr_t and uintptr_t for others than + mcs51 and ds390. + * device/include/hc08/mc68hc908gp32.h, + * device/include/hc08/mc68hc908jb8.h, + * device/include/hc08/mc68hc908jkjl.h, + * device/include/hc08/mc68hc908qy.h: fixed comments + * device/include/mcs51/README: updated + * device/include/mcs51/c8051f120.h: added PINRSF + * device/lib/pic16/libc/stdlib/crc16.c: fixed comments + * src/pic16/pcode.c: MSVC6 doesn't accept declaring new variables + amidst code. Also inline is not supported. + 2005-04-06 Raphael Neider * src/pic16/pcode.c (pic16_pCodeReplace): also update pcflow->end @@ -6,17 +22,17 @@ 2005-04-06 Vangelis Rokas - * device/include/pic16/usart.h: added, missing in previous commit, - * device/include/pic16/adc.h: fixed typo, - * device/lib/pic16/libc/utils/cvtdec.S: added missing in previous - commit, - * device/lib/pic16/libc/stdlib/g_ftoa.S: modified to include - - * device/lib/pic16/libc/stdio/streams.c: leave stdin, stdout - uninitialized because a bug appears with gplink - * device/lib/pic16/{some makefiles}: moved $(CSTD) from CFLAGS to - COMPILE_FLAGS and added CPPFLAGS with -nostdinc because sdcpp - complains for unrecognised option + * device/include/pic16/usart.h: added, missing in previous commit, + * device/include/pic16/adc.h: fixed typo, + * device/lib/pic16/libc/utils/cvtdec.S: added missing in previous + commit, + * device/lib/pic16/libc/stdlib/g_ftoa.S: modified to include + + * device/lib/pic16/libc/stdio/streams.c: leave stdin, stdout + uninitialized because a bug appears with gplink + * device/lib/pic16/{some makefiles}: moved $(CSTD) from CFLAGS to + COMPILE_FLAGS and added CPPFLAGS with -nostdinc because sdcpp + complains for unrecognised option 2005-04-05 Raphael Neider @@ -159,7 +175,7 @@ * device/include/mcs51/c8051f350.h, * device/include/z180.h: Changed SDCC specific keywords to double underlined form. - + 2005-03-31 Vangelis Rokas * src/pic16/device.c (Pics16[]): added devices 18F2550, 18F4331, @@ -204,7 +220,7 @@ should be removed from local register store/restore in/from stack block, * src/pic16/ralloc.c (pic16_decodeOp): added decode for - DUMMY_READ_VOLATILE, + DUMMY_READ_VOLATILE, * device/include/pic16/adc.h: minor prototype modifications and update, diff --git a/device/include/hc08/mc68hc908gp32.h b/device/include/hc08/mc68hc908gp32.h index 25a756fa..d74c021a 100644 --- a/device/include/hc08/mc68hc908gp32.h +++ b/device/include/hc08/mc68hc908gp32.h @@ -9,7 +9,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2, or (__at your option) any + Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/device/include/hc08/mc68hc908jb8.h b/device/include/hc08/mc68hc908jb8.h index 249a1b38..5f827f99 100644 --- a/device/include/hc08/mc68hc908jb8.h +++ b/device/include/hc08/mc68hc908jb8.h @@ -9,7 +9,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2, or (__at your option) any + Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/device/include/hc08/mc68hc908jkjl.h b/device/include/hc08/mc68hc908jkjl.h index 842b71af..bcfa244b 100644 --- a/device/include/hc08/mc68hc908jkjl.h +++ b/device/include/hc08/mc68hc908jkjl.h @@ -9,7 +9,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2, or (__at your option) any + Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/device/include/hc08/mc68hc908qy.h b/device/include/hc08/mc68hc908qy.h index e1373642..7a825700 100644 --- a/device/include/hc08/mc68hc908qy.h +++ b/device/include/hc08/mc68hc908qy.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2, or (__at your option) any + Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/device/include/mcs51/README b/device/include/mcs51/README index 89fef239..b8cde2be 100644 --- a/device/include/mcs51/README +++ b/device/include/mcs51/README @@ -1,2 +1,6 @@ -sdcc/device/lib/mcs51 ---------------------- +sdcc/device/include/mcs51 +------------------------- + +A lot of the include files in this subdirectory used to be in the directory +one level up from here. Since CVS doesn't support moving files, these files +were removed there and added here. diff --git a/device/include/mcs51/c8051f120.h b/device/include/mcs51/c8051f120.h index 10ab4331..1541b39f 100644 --- a/device/include/mcs51/c8051f120.h +++ b/device/include/mcs51/c8051f120.h @@ -457,6 +457,7 @@ __sbit __at 0xFF P7_7 ; #define CAPP 0x20 /* PCA0CPMn */ #define ECOM 0x40 /* PCA0CPMn */ #define PWM16 0x80 /* PCA0CPMn */ +#define PINRSF 0x01 /* RSTSRC */ #define PORSF 0x02 /* RSTSRC */ #define SWRSF 0x10 /* RSTSRC */ diff --git a/device/include/stdarg.h b/device/include/stdarg.h index 69263514..671b0e2b 100644 --- a/device/include/stdarg.h +++ b/device/include/stdarg.h @@ -19,13 +19,13 @@ typedef unsigned char * va_list ; #elif defined(SDCC_USE_XSTACK) -typedef unsigned char pdata * va_list ; +typedef unsigned char __pdata * va_list ; #define va_arg(marker,type) *((type __data *)(marker -= sizeof(type))) #define va_start(marker,first) { marker = (va_list)((char __pdata *)&first); } #else -typedef unsigned char data * va_list ; +typedef unsigned char __data * va_list ; #define va_arg(marker,type) *((type __data * )(marker -= sizeof(type))) #define va_start(marker,first) { marker = (va_list) ((char __data * )&first); } diff --git a/device/include/stdint.h b/device/include/stdint.h index 12b26d5b..14512498 100644 --- a/device/include/stdint.h +++ b/device/include/stdint.h @@ -62,8 +62,13 @@ typedef unsigned long int uint_fast32_t; /* Types for `void *' pointers. */ -typedef long int intptr_t; -typedef unsigned long int uintptr_t; +#if defined (SDCC_mcs51) || defined (SDCC_ds390) + typedef long int intptr_t; + typedef unsigned long int uintptr_t; +#else + typedef int intptr_t; + typedef unsigned int uintptr_t; +#endif /* Largest integral types. */ @@ -117,9 +122,15 @@ typedef unsigned long int uintmax_t; # define UINT_FAST32_MAX (4294967295UL) /* Values to test for integral types holding `void *' pointer. */ +#if defined (SDCC_mcs51) || defined (SDCC_ds390) # define INTPTR_MIN (-2147483647L-1) # define INTPTR_MAX (2147483647L) # define UINTPTR_MAX (4294967295UL) +#else +# define INTPTR_MIN (-32767-1) +# define INTPTR_MAX (32767) +# define UINTPTR_MAX (65535) +#endif /* Minimum for largest signed integral type. */ # define INTMAX_MIN (-__INT32_C(-2147483647L)-1) @@ -133,8 +144,13 @@ typedef unsigned long int uintmax_t; /* Limits of other integer types. */ /* Limits of `ptrdiff_t' type. */ +#if defined (SDCC_mcs51) || defined (SDCC_ds390) # define PTRDIFF_MIN (-2147483647L-1) # define PTRDIFF_MAX (2147483647L) +#else +# define PTRDIFF_MIN (-32767-1) +# define PTRDIFF_MAX (32767) +#endif /* Limit of `size_t' type. */ # define SIZE_MAX (65535) diff --git a/device/lib/pic16/libc/stdlib/crc16.c b/device/lib/pic16/libc/stdlib/crc16.c index 357a9901..23c3e495 100644 --- a/device/lib/pic16/libc/stdlib/crc16.c +++ b/device/lib/pic16/libc/stdlib/crc16.c @@ -79,7 +79,7 @@ __code uint16_t crc_table[256] = { * * DESCRIPTION * The OSTA-UDF(tm) 1.50 standard states that using CRCs is mandatory. - * The polynomial used is: x^16 + x^12 + x^15 + 1 + * The polynomial used is: x^16 + x^12 + x^5 + 1 * * PRE-CONDITIONS * data Pointer to the data block. diff --git a/src/pic16/pcode.c b/src/pic16/pcode.c index 49f86f72..79f6d152 100644 --- a/src/pic16/pcode.c +++ b/src/pic16/pcode.c @@ -34,6 +34,7 @@ #if defined(__BORLANDC__) || defined(_MSC_VER) #define STRCASECMP stricmp +#define inline #else #define STRCASECMP strcasecmp #endif @@ -9431,7 +9432,7 @@ static int pic16_safepCodeUnlink (pCode *pc, char *comment) { if (0 || pic16_debug_verbose || pic16_pcode_verbose) { len = strlen (buf) + strlen (comment) + 10; total = (char *) Safe_malloc (len); - snprintf (total, len, "%s: %s", comment, buf); + SNPRINTF (total, len, "%s: %s", comment, buf); pic16_pCodeInsertAfter (pc, pic16_newpCodeCharP(total)); Safe_free (total); } @@ -9531,9 +9532,6 @@ static symbol_t symFromStr (const char *str) { if (!map_symToStr) { int i; - map_strToSym = newHashTable (128); - map_symToStr = newHashTable (128); - struct { char *name; symbol_t sym; } predefsyms[] = { {"WREG", SPO_WREG}, {"STATUS", SPO_STATUS}, @@ -9575,6 +9573,9 @@ static symbol_t symFromStr (const char *str) { {NULL, 0} }; + map_strToSym = newHashTable (128); + map_symToStr = newHashTable (128); + for (i=0; predefsyms[i].name; i++) { char *name; @@ -11457,8 +11458,8 @@ static void assignValnums (pCode *pc) { case POC_XORLW: /* modifies STATUS (Z,N) */ /* can be optimized iff WREG contains a known literal (0x100 - 0x1FF) */ if (pci->pcop->type == PO_LITERAL) { - lit = (unsigned char) PCOL(pci->pcop)->lit; int vallit = -1; + lit = (unsigned char) PCOL(pci->pcop)->lit; val = defmapCurr (list, SPO_WREG, pc); if (val) vallit = litFromValnum (val->in_val); if (vallit != -1) { @@ -12059,7 +12060,7 @@ static void pic16_vcg_close (FILE *of) { } #define BUF_SIZE 128 -#define pcTitle(pc) (snprintf (buf, BUF_SIZE, "n_%p, %p/%u", PCODE(pc), isPCI(pc) ? PCI(pc)->pcflow : NULL, PCODE(pc)->seq), &buf[0]) +#define pcTitle(pc) (SNPRINTF (buf, BUF_SIZE, "n_%p, %p/%u", PCODE(pc), isPCI(pc) ? PCI(pc)->pcflow : NULL, PCODE(pc)->seq), &buf[0]) #if 0 static int ptrcmp (const void *p1, const void *p2) { @@ -12236,9 +12237,9 @@ static void pic16_vcg_dump_default (pBlock *pb) { pc = pb->pcHead; while (pc && !isPCF(pc)) pc = pc->next; if (pc) { - snprintf (buf, BUF_SIZE, "%s_%s.vcg", PCF(pc)->modname, PCF(pc)->fname); + SNPRINTF (buf, BUF_SIZE, "%s_%s.vcg", PCF(pc)->modname, PCF(pc)->fname); } else { - snprintf (buf, BUF_SIZE, "pb_%p.vcg", pb); + SNPRINTF (buf, BUF_SIZE, "pb_%p.vcg", pb); } //fprintf (stderr, "now dumping %s\n", buf);