* device/lib/time.c (mktime): fixed bug reported by Bert Thomas
authorbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 9 Mar 2004 21:36:07 +0000 (21:36 +0000)
committerbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 9 Mar 2004 21:36:07 +0000 (21:36 +0000)
* sdcc.spec: updated and split sdcc into 3 rpms
* src/SDCCast.c (decorateType): &|^ don't need addCast(); addCast() is needed for literals of LEFT_OP and '+'
* src/SDCCicode.c (geniCodeLogic): I must have been braindead when I introduced RESULT_TYPE_NOPROM
* src/SDCCsymt.c (computeType): op is int; added RESULT_TYPE_OTHER; limited promotion to int only for '*'
* src/SDCCsymt.h (computeType): op is int, removed RESULT_TYPE_NOPROM

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

ChangeLog
sdcc.spec
src/SDCCast.c
src/SDCCicode.c
src/SDCCsymt.c
src/SDCCsymt.h

index 7c9881c89902823fb7a97e1e162aa880dc7b4521..055c17629859179d967652025df36b20098de1bf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,14 @@
 2004-03-09 Bernhard Held <bernhard AT bernhardheld.de>
 
        * device/lib/time.c (mktime): fixed bug reported by Bert Thomas
+       * sdcc.spec: updated and split sdcc into 3 rpms
+       * src/SDCCast.c (decorateType): &|^ don't need addCast(); addCast() is
+       needed for literals of LEFT_OP and '+'
+       * src/SDCCicode.c (geniCodeLogic): I must have been braindead when I
+       introduced RESULT_TYPE_NOPROM
+       * src/SDCCsymt.c (computeType): op is int; added RESULT_TYPE_OTHER;
+       limited promotion to int only for '*'
+       * src/SDCCsymt.h (computeType): op is int, removed RESULT_TYPE_NOPROM
 
 2004-03-09 Hans Dorn <hjdorn AT users.sourceforge.net>
 
index 862be2a9e4aee90f6b5caad7342b5b704d032dca..9d6991ba4381ee694e46992d49ae194c5301b0df 100644 (file)
--- a/sdcc.spec
+++ b/sdcc.spec
@@ -4,15 +4,15 @@
 
 Name:          sdcc
 Requires:      /bin/sh
-License:       GPL, LGPL
+License:       GPL
 Group:         Applications/Engineering
-Provides:      sdcc
 Summary:       Small Device C Compiler
-Version:       2.3.7
-Release:       4
+Requires:      sdcc-common
+Version:       2.4.0
+Release:       1
 Source:        %{name}-%{version}.tar.bz2
 URL:           http://sdcc.sourceforge.net/
-Packager:      Bernhard Held <bernhard@bernhardheld.de>
+Packager:      Bernhard Held <bernhard AT bernhardheld.de>
 BuildRoot:     %{_tmppath}/%{name}-%{version}-build
 
 %description
@@ -21,6 +21,29 @@ The package includes the compiler, assemblers and linkers, a device
 simulator and a core library. The processors supported (to a varying
 degree) include the 8051, ds390, z80, hc08, and PIC.
 
+%package common
+License:       GPL, LGPL
+Group:         Application/Engineering
+Summary:       Libraries and Header Files for the SDCC C compiler
+Requires:      sdcc
+
+%description common
+SDCC is a C compiler for 8051 class and similar microcontrollers.
+The package includes the compiler, assemblers and linkers, a device
+simulator and a core library. The processors supported (to a varying
+degree) include the 8051, ds390, z80, hc08, and PIC.
+
+%package doc
+License:       GPL
+Group:         Applications/Engineering
+Summary:       Documentation for the SDCC C compiler
+
+%description doc
+SDCC is a C compiler for 8051 class and similar microcontrollers.
+The package includes the compiler, assemblers and linkers, a device
+simulator and a core library. The processors supported (to a varying
+degree) include the 8051, ds390, z80, hc08, and PIC.
+
 %prep
 %setup -n sdcc
 
@@ -32,21 +55,34 @@ make
 cd ..
 
 %install
-rm -rf $RPM_BUILD_ROOT/usr
+rm -rf $RPM_BUILD_ROOT
 make prefix=$RPM_BUILD_ROOT/usr install
 cd doc
 make install
 cd ..
 
+%clean
+rm -rf $RPM_BUILD_ROOT
+
 %files
 %defattr(-,root,root)
 /usr/bin
+
+%files common
+%defattr(-,root,root)
 /usr/share/sdcc/include
 /usr/share/sdcc/lib
+
+%files doc
+%defattr(-,root,root)
 %doc %{_defaultdocdir}
 
 %changelog
-* Sun Jan 04 2004 - bernhard@bernhardheld.de
+* Tue Mar 09 2004 - bernhard AT bernhardheld.de
+- split into two packages
+* Wed Feb 26 2004 - bernhard AT bernhardheld.de
+- version updated
+* Sun Jan 04 2004 - bernhard AT bernhardheld.de
 - updated
-* Sat Apr 27 2002 - steve@icarus.com
+* Sat Apr 27 2002 - steve AT icarus.com
 - first version from Stephen Williams
index 7f34fdb5b37b8319ce6f4d8b83e9c6a5dff2a7bc..2c167ef1adbfb641d3cd31c4c46bb9f511365891 100644 (file)
@@ -2562,8 +2562,6 @@ decorateType (ast * tree, RESULT_TYPE resultType)
              return decorateType (otree, RESULT_CHECK);
          }
 
-         tree->left  = addCast (tree->left,  resultType, FALSE);
-         tree->right = addCast (tree->right, resultType, FALSE);
          TTYPE (tree) = computeType (LTYPE (tree),
                                      RTYPE (tree),
                                      resultType,
@@ -2780,8 +2778,6 @@ decorateType (ast * tree, RESULT_TYPE resultType)
         }
 
       LRVAL (tree) = RRVAL (tree) = 1;
-      tree->left  = addCast (tree->left,  resultType, FALSE);
-      tree->right = addCast (tree->right, resultType, FALSE);
       TETYPE (tree) = getSpec (TTYPE (tree) =
                               computeType (LTYPE (tree),
                                            RTYPE (tree),
@@ -3066,6 +3062,8 @@ decorateType (ast * tree, RESULT_TYPE resultType)
       if (IS_LITERAL (RTYPE (tree)) && IS_LITERAL (LTYPE (tree)))
        {
          tree->type = EX_VALUE;
+         tree->left  = addCast (tree->left,  resultType, TRUE);
+          tree->right = addCast (tree->right, resultType, TRUE);
          tree->opval.val = valPlus (valFromType (LETYPE (tree)),
                                     valFromType (RETYPE (tree)));
          tree->right = tree->left = NULL;
@@ -3207,6 +3205,8 @@ decorateType (ast * tree, RESULT_TYPE resultType)
       if (IS_LITERAL (RTYPE (tree)) && IS_LITERAL (LTYPE (tree)))
        {
          tree->type = EX_VALUE;
+         tree->left  = addCast (tree->left,  resultType, TRUE);
+         tree->right = addCast (tree->right, resultType, TRUE);
          tree->opval.val = valMinus (valFromType (LETYPE (tree)),
                                      valFromType (RETYPE (tree)));
          tree->right = tree->left = NULL;
@@ -3240,6 +3240,7 @@ decorateType (ast * tree, RESULT_TYPE resultType)
        {
          tree->left  = addCast (tree->left,  resultType, TRUE);
          tree->right = addCast (tree->right, resultType, TRUE);
+
          TETYPE (tree) = getSpec (TTYPE (tree) =
                                     computeType (LTYPE (tree),
                                                  RTYPE (tree),
@@ -3371,6 +3372,10 @@ decorateType (ast * tree, RESULT_TYPE resultType)
          goto errorTreeReturn;
        }
 
+      /* make smaller type only if it's a LEFT_OP */
+      if (tree->opval.op == LEFT_OP)
+        tree->left = addCast (tree->left, resultType, TRUE);
+      
       /* if they are both literal then */
       /* rewrite the tree */
       if (IS_LITERAL (RTYPE (tree)) && IS_LITERAL (LTYPE (tree)))
@@ -3388,7 +3393,6 @@ decorateType (ast * tree, RESULT_TYPE resultType)
       LRVAL (tree) = RRVAL (tree) = 1;
       if (tree->opval.op == LEFT_OP)
        {
-         tree->left = addCast (tree->left, resultType, TRUE);
          TETYPE (tree) = getSpec (TTYPE (tree) =
                                       computeType (LTYPE (tree),
                                                    NULL,
index b359b83091109012f175425393b2c0e28ca7f747..cdd103c000c430f73003c19fed3d35253c6efe5c 100644 (file)
@@ -2876,7 +2876,7 @@ geniCodeLogic (operand * left, operand * right, int op)
         }
     }
 
-  ctype = usualBinaryConversions (&left, &right, RESULT_TYPE_NOPROM, 0);
+  ctype = usualBinaryConversions (&left, &right, RESULT_TYPE_NONE, 0);
 
   ic = newiCode (op, left, right);
   IC_RESULT (ic) = newiTempOperand (newCharLink (), 1);
index 53901c347ce67177c4fb4cf3021295e5275e1bed..dcce5fcc763cb0fa810479f42b433a818eb23df6 100644 (file)
@@ -1661,7 +1661,7 @@ computeTypeOr (sym_link * etype1, sym_link * etype2, sym_link * reType)
 /*------------------------------------------------------------------*/
 sym_link *
 computeType (sym_link * type1, sym_link * type2,
-             RESULT_TYPE resultType, char op)
+             RESULT_TYPE resultType, int op)
 {
   sym_link *rType;
   sym_link *reType;
@@ -1733,6 +1733,7 @@ computeType (sym_link * type1, sym_link * type2,
        break;
       case RESULT_TYPE_INT:
       case RESULT_TYPE_NONE:
+      case RESULT_TYPE_OTHER:
        if (IS_BIT (reType))
          {
            SPEC_NOUN (reType) = V_CHAR;
@@ -1759,7 +1760,16 @@ computeType (sym_link * type1, sym_link * type2,
                SPEC_USIGN (reType) = 1;
                return rType;
              }
-           else
+           else if (op == '*')
+             {
+               SPEC_NOUN (reType) = V_INT;
+               SPEC_USIGN (reType) = 0;
+               return rType;
+             }
+           /* TODO: should be in SDCCast.c */
+           else if (   op == '/'
+                    && (   !SPEC_USIGN (etype1)
+                        || !SPEC_USIGN (etype2)))
              {
                SPEC_NOUN (reType) = V_INT;
                SPEC_USIGN (reType) = 0;
index 82acf79b6bab1546cf9fcf7e44a034597af80c15..353f41f6f9fd0164ffc0f20077182b825932d8cb 100644 (file)
@@ -513,7 +513,6 @@ typedef enum
   RESULT_TYPE_INT,
   RESULT_TYPE_OTHER,   /* operands will be promoted to int */
   RESULT_TYPE_IFX,
-  RESULT_TYPE_NOPROM,  /* operands will be promoted to int */
 } RESULT_TYPE;
 
 /* forward definitions for the symbol table related functions */
@@ -555,7 +554,7 @@ int funcInChain (sym_link *);
 void addSymChain (symbol *);
 sym_link *structElemType (sym_link *, value *);
 symbol *getStructElement (structdef *, symbol *);
-sym_link *computeType (sym_link *, sym_link *, RESULT_TYPE, char);
+sym_link *computeType (sym_link *, sym_link *, RESULT_TYPE, int);
 void processFuncArgs (symbol *);
 int isSymbolEqual (symbol *, symbol *);
 int powof2 (TYPE_UDWORD);