* device/lib/pic16/Makefile.common.in: add --optimize-df to OPT_FLAGS
authortecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 14 May 2005 12:11:22 +0000 (12:11 +0000)
committertecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 14 May 2005 12:11:22 +0000 (12:11 +0000)
* device/lib/pic16/libc/stdlib/itoa.c (new)
* device/lib/pic16/libc/stdlib/Makefile: have itoa.c built
* device/lib/pic16/libio/Makefile: exclude subdir according to
  ${subdir}.ignore for certain PICs (lacking e.g. i2c)
* device/lib/pic16/libio/i2c.ignore (new): pic18f1220 has no I2C support
* src/pic16/gen.c (genFunction): prevent annoying warning
* src/pic16/pcode.c: renamed stack_t to dynstack_t to prevent
  nameclashes on BeOS
* support/cpp2/cppmain.c (cpp_output_string): new
* support/cpp2/cpplib.c (_cpp_do__Pragma): fixed _Pragma (""),
  fixes bug 1116802

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3756 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
device/lib/pic16/Makefile.common.in
device/lib/pic16/libc/stdlib/Makefile
device/lib/pic16/libc/stdlib/itoa.c [new file with mode: 0644]
device/lib/pic16/libio/Makefile
device/lib/pic16/libio/i2c.ignore [new file with mode: 0644]
src/pic16/gen.c
src/pic16/pcode.c
support/cpp2/cpplib.c
support/cpp2/cppmain.c

index 126396f2b22525a7acf7757fa2907fcdef9c597d..bbe29f0e9f446425aefde30fed1c116d4d5bd539 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2005-05-14 Raphael Neider <rneider AT web.de>
+
+       * device/lib/pic16/Makefile.common.in: add --optimize-df to OPT_FLAGS
+       * device/lib/pic16/libc/stdlib/itoa.c (new)
+       * device/lib/pic16/libc/stdlib/Makefile: have itoa.c built
+       * device/lib/pic16/libio/Makefile: exclude subdir according to
+         ${subdir}.ignore for certain PICs (lacking e.g. i2c)
+       * device/lib/pic16/libio/i2c.ignore (new): pic18f1220 has no I2C support
+       * src/pic16/gen.c (genFunction): prevent annoying warning
+       * src/pic16/pcode.c: renamed stack_t to dynstack_t to prevent
+         nameclashes on BeOS
+       * support/cpp2/cppmain.c (cpp_output_string): new
+       * support/cpp2/cpplib.c (_cpp_do__Pragma): fixed _Pragma(""),
+         fixes bug 1116802
+
 2005-05-13 Borut Razem <borut.razem AT siol.net>
 
        * src/SDCCmain.c (linkEdit): fixed bug 1195202
index c9fef252a7c58c63892cd5cf0edba2cbefa47b69..b90c055965994c38a6ea4a3e9adb26326c1b7d01 100644 (file)
@@ -35,4 +35,5 @@ MODELFLAGS      = -mpic16
 OPT_FLAGS      += --denable-peeps
 OPT_FLAGS      += --obanksel=9
 OPT_FLAGS      += --optimize-goto
+OPT_FLAGS      += --optimize-df
 OPT_FLAGS      += --i-code-in-asm
index bb727da0c5e60266b2b30679077fe183d6523625..07ba9c16339561ff0f1a9eafee6e13f8031db53e 100644 (file)
@@ -18,6 +18,7 @@ SRCS  =       atof \
                atol \
                calloc \
                free \
+               itoa \
                ltoa \
                malloc \
                memfree \
diff --git a/device/lib/pic16/libc/stdlib/itoa.c b/device/lib/pic16/libc/stdlib/itoa.c
new file mode 100644 (file)
index 0000000..f788fa0
--- /dev/null
@@ -0,0 +1,34 @@
+/*-------------------------------------------------------------------
+ itoa.c - convert (unsigned) int to strings
+
+ written by: Raphael Neider <rneider@web.de>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+
+ $Id$
+-------------------------------------------------------------------*/
+
+#include <stdlib.h>
+
+void uitoa (unsigned int value, __data char *str, unsigned char radix)
+{
+  ultoa (value, str, radix);
+}
+
+void itoa (int value, __data char *str, unsigned char radix)
+{
+  ltoa (value, str, radix);
+}
+
index 8dc2251c0da66a4c03107d4bd60a603806ab4be0..6e9e72fc67c8d038b89b63cb3e5621aa6270d558 100644 (file)
@@ -37,11 +37,14 @@ build-libraries:
 build-processor-library:
        for dir in $(DIRS) ; do  \
                $(MAKE) -C $$dir clean ; \
-               $(MAKE) -C $$dir build-io-lib MCU=18f$(MMCU); \
+               grep $(MMCU) "$${dir}.ignore" > /dev/null 2>&1 || $(MAKE) -C $$dir build-io-lib MCU=18f$(MMCU); \
        done;
-       gplib -c $(LIB) $(LOBJS)
+       make invoke-gplib
        mv -v $(LIB) ../bin
-       
+
+# needed so that make updates the list of .o files correctly...
+invoke-gplib:
+       gplib -c $(LIB) $(foreach dir,$(DIRS),$(wildcard $(dir)/*.o))
 
 clean-intermediate:
        @for dir in $(DIRS) ; do \
diff --git a/device/lib/pic16/libio/i2c.ignore b/device/lib/pic16/libio/i2c.ignore
new file mode 100644 (file)
index 0000000..1518612
--- /dev/null
@@ -0,0 +1 @@
+1220
index b181f94c04f717b32e9686f5b1780fc2adc61e0b..5b67864794e4fb21433a63fbb2f95a30565fbf01 100644 (file)
@@ -3674,7 +3674,8 @@ static void genFunction (iCode *ic)
           pic16_addpCode2pBlock(apb, pic16_newpCodeCharP(";-----------------------------------------"));
           pic16_addpCode2pBlock(apb, pic16_newpCodeFunction(moduleName, asym->name));
           //pic16_addpCode2pBlock(apb, pic16_newpCode(POC_GOTO, pic16_popGetWithString( sym->rname )));
-          pic16_addpCode2pBlock(apb, pic16_newpCode(POC_GOTO, pic16_newpCodeOpLabel (sym->rname, 0)));
+          //pic16_addpCode2pBlock(apb, pic16_newpCode(POC_GOTO, pic16_newpCodeOpLabel (sym->rname, 0)));
+         pic16_addpCode2pBlock(apb, pic16_newpCodeAsmDir ("GOTO", "%s", sym->rname)); /* this suppresses a warning in LinkFlow */
                
           /* mark the end of this tiny function */
           pic16_addpCode2pBlock(apb,pic16_newpCodeFunction(NULL,NULL));
index b55056db7cd68cd66548af767dbf2a8fbcd18141..c2f6ae2e24914802ec1ffdc209746730273cc29d 100644 (file)
@@ -9911,18 +9911,18 @@ typedef struct stack_s {
   struct stack_s *next;
 } stackitem_t;
 
-typedef stackitem_t *stack_t;
+typedef stackitem_t *dynstack_t;
 static stackitem_t *free_stackitems = NULL;
 
 /* Create a stack with one item. */
-static stack_t *newStack () {
-  stack_t *s = (stack_t *) Safe_malloc (sizeof (stack_t));
+static dynstack_t *newStack () {
+  dynstack_t *s = (dynstack_t *) Safe_malloc (sizeof (dynstack_t));
   *s = NULL;
   return s;
 }
 
 /* Remove a stack -- its items are only marked free. */
-static void deleteStack (stack_t *s) {
+static void deleteStack (dynstack_t *s) {
   stackitem_t *i;
 
   while (*s) {
@@ -9945,7 +9945,7 @@ static void releaseStack () {
   } // while
 }
 
-static void stackPush (stack_t *stack, void *data) {
+static void stackPush (dynstack_t *stack, void *data) {
   stackitem_t *i;
   
   if (free_stackitems) {
@@ -9959,7 +9959,7 @@ static void stackPush (stack_t *stack, void *data) {
   *stack = i;
 }
 
-static void *stackPop (stack_t *stack) {
+static void *stackPop (dynstack_t *stack) {
   void *data;
   stackitem_t *i;
   
@@ -9976,7 +9976,7 @@ static void *stackPop (stack_t *stack) {
 }
 
 #if 0
-static int stackContains (stack_t *s, void *data) {
+static int stackContains (dynstack_t *s, void *data) {
   stackitem_t *i;
   if (!s) return 0;
   i = *s;
@@ -9990,7 +9990,7 @@ static int stackContains (stack_t *s, void *data) {
 }
 #endif
 
-static int stackIsEmpty (stack_t *s) {
+static int stackIsEmpty (dynstack_t *s) {
   return (*s == NULL);
 }
 
@@ -10011,7 +10011,7 @@ static void deleteState (state_t *s) {
   Safe_free (s);
 }
 
-static int stateIsNew (state_t *state, stack_t *todo, stack_t *done) {
+static int stateIsNew (state_t *state, dynstack_t *todo, dynstack_t *done) {
   stackitem_t *i;
 
   /* scan working list for state */
@@ -10098,8 +10098,8 @@ static int defmapFindAll (symbol_t sym, pCode *pc, defmap_t **chain) {
   pCodeFlow *curr;
   pCodeFlowLink *succ;
   state_t *state;
-  stack_t *todo;       /** stack of state_t */
-  stack_t *done;       /** stack of state_t */
+  dynstack_t *todo;    /** stack of state_t */
+  dynstack_t *done;    /** stack of state_t */
 
   int firstState, n_defs;
   
@@ -10453,7 +10453,7 @@ int pic16_isAliveInFlow (symbol_t sym, int mask, pCodeFlow *pcfl, pCode *pc) {
 static int pic16_isAlive (symbol_t sym, pCode *pc) {
   int mask, visit;
   defmap_t *map;
-  stack_t *todo, *done;
+  dynstack_t *todo, *done;
   state_t *state;
   pCodeFlow *pcfl;
   pCodeFlowLink *succ;
index 2b3512b8cc87b6abf84afc7d96fe53aff6452c93..93621adb25554671a36eba1f6909bbe0f6ff7437 100644 (file)
@@ -111,6 +111,8 @@ static struct answer ** find_answer PARAMS ((cpp_hashnode *,
                                             const struct answer *));
 static void handle_assertion   PARAMS ((cpp_reader *, const char *, int));
 
+extern cpp_output_string (const char *s);
+
 /* This is the table of directive handlers.  It is ordered by
    frequency of occurrence; the numbers at the end are directive
    counts from all the source code I have lying around (egcs and libc
@@ -1285,7 +1287,9 @@ _cpp_do__Pragma (pfile)
     }
 
   buffer = destringize (&string.val.str, &len);
-  run_directive (pfile, T_PRAGMA, BUF_PRAGMA, (char *) buffer, len);
+  buffer[len] = 0;
+  cpp_output_string ("\n#pragma "); cpp_output_string (buffer); cpp_output_string ("\n");
+  //run_directive (pfile, T_PRAGMA, BUF_PRAGMA, (char *) buffer, len);
   free ((PTR) buffer);
 }
 
index 004aeebc710e83b5179515256f63954ea9d6a36a..95fd2955ea1ba8439b25de04d60877880a9a3aec 100644 (file)
@@ -441,6 +441,11 @@ cb_def_pragma (pfile)
   print.lineno++;
 }
 
+void
+cpp_output_string (const char *s) {
+  fputs (s, print.outf);
+}
+
 /* Dump out the hash table.  */
 static int
 dump_macro (pfile, node, v)