projects
/
fw
/
sdcc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Support nested parenthesis in peephole function arguments (#1967300)
[fw/sdcc]
/
src
/
SDCCpeeph.c
diff --git
a/src/SDCCpeeph.c
b/src/SDCCpeeph.c
index 075cad2abc12af5ba428411386de4a84553bac5b..e413d49930edb78bdfff6292ef757c5aa3eae650 100644
(file)
--- a/
src/SDCCpeeph.c
+++ b/
src/SDCCpeeph.c
@@
-1269,9
+1269,18
@@
callFuncByName (char *fname,
/* and there can be no additional conditions. */
if (c == '(')
{
/* 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 == ')')
{
*cmdTerm = '\0'; /* terminate the arguments */
if (c == ')')
{