* src/SDCCast.c: fixed feature request
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 27 Apr 2007 06:42:06 +0000 (06:42 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 27 Apr 2007 06:42:06 +0000 (06:42 +0000)
  #1547512: Redundant strings linked when using sizeof("abc")

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

ChangeLog
src/SDCCast.c

index 46b6324869c97d7a5f0ad45210c0551720ea7c07..15ff63b6e01752f3ff612a24ae0dd029531d4af2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-04-27 Borut Razem <borut.razem AT siol.net>
+
+       * 
+
 2007-04-23 Borut Razem <borut.razem AT siol.net>
 
        * doc/sdccman.lyx, src/SDCCmain.c:
index 88e0fa181b38688af06ff662fc3b603543253343..9c929bd9dc0f663d4a59fa4d765e8e9e235a35c7 100644 (file)
@@ -2569,6 +2569,12 @@ decorateType (ast * tree, RESULT_TYPE resultType)
              there is resultType available */
           dtr = tree->right;
           break;
+        case SIZEOF:
+          /* don't allocate string if it is a sizeof argument */
+          ++noAlloc;
+          dtr = decorateType (tree->right, resultTypeProp);
+          --noAlloc;
+          break;
         default:
           dtr = decorateType (tree->right, resultTypeProp);
           break;
@@ -4257,6 +4263,7 @@ decorateType (ast * tree, RESULT_TYPE resultType)
       /* change the type to a integer */
       {
         int size = getSize (tree->right->ftype);
+
         SNPRINTF(buffer, sizeof(buffer), "%d", size);
         if (!size && !IS_VOID(tree->right->ftype))
           werrorfl (tree->filename, tree->lineno, E_SIZEOF_INCOMPLETE_TYPE);
@@ -4266,6 +4273,7 @@ decorateType (ast * tree, RESULT_TYPE resultType)
       tree->right = tree->left = NULL;
       TETYPE (tree) = getSpec (TTYPE (tree) =
                                tree->opval.val->type);
+
       return tree;
 
       /*------------------------------------------------------------------*/