Support nested parenthesis in peephole function arguments (#1967300)
authorspth <spth@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 19 May 2008 19:58:11 +0000 (19:58 +0000)
committerspth <spth@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 19 May 2008 19:58:11 +0000 (19:58 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5163 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/SDCCpeeph.c

index 76bd864004bd92b3e772cfb8f6807346b3f7e7d5..7f37a001807a795d4b2bd45ca241566e60a72a23 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-05-19  Philipp Klaus Krause <pkk AT spth.de>
+
+       * src/SDCCpeeph.c (callFuncByName):
+         Support nested parenthesis in peephole function arguments (#1967300)
+
 2008-05-19 Raphael Neider <rneider AT web.de>
 
        * src/pic16/gen.c (pic16_emitpLabel,pic16_emitpLabelFORCE):
index 075cad2abc12af5ba428411386de4a84553bac5b..e413d49930edb78bdfff6292ef757c5aa3eae650 100644 (file)
@@ -1269,9 +1269,18 @@ callFuncByName (char *fname,
       /* and there can be no additional conditions.             */
       if (c == '(')
         {
-          cmdTerm = funcArgs;
-          while ((c = *cmdTerm) && c != ')')
-            cmdTerm++;
+
+          int num_parenthesis = 0;
+          cmdTerm = funcArgs;          
+
+          while ((c = *cmdTerm) && (c != ')' || num_parenthesis))
+            {
+              if (c == '(')
+                num_parenthesis++;
+              else if (c == ')')
+                num_parenthesis--;
+              cmdTerm++;
+            }
           *cmdTerm = '\0';  /* terminate the arguments */
           if (c == ')')
             {