Skip to content

Commit 3b6e925

Browse files
committed
parseReturnType should start from the first non-brace token
1 parent 0a88c52 commit 3b6e925

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

c.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,6 @@ static const char *implementationString (const impType imp)
567567
/*
568568
* Debugging functions
569569
*/
570-
#define DEBUG
571570
#ifdef DEBUG
572571

573572
#define boolString(c) ((c) ? "TRUE" : "FALSE")
@@ -2120,6 +2119,7 @@ static void parseReturnType (statementInfo *const st)
21202119
{
21212120
int i;
21222121
int lower_bound;
2122+
int upper_bound;
21232123
tokenInfo * finding_tok;
21242124

21252125
/* FIXME TODO: if java language must be supported then impement this here
@@ -2161,8 +2161,21 @@ static void parseReturnType (statementInfo *const st)
21612161
}
21622162
else
21632163
lower_bound = 1;
2164-
2165-
for (i = (unsigned int) NumTokens; i > lower_bound; i--)
2164+
2165+
upper_bound = -1;
2166+
for (i = 0; i < NumTokens; i++) {
2167+
tokenInfo *curr_tok;
2168+
curr_tok = prevToken (st, i);
2169+
if (curr_tok->type == TOKEN_BRACE_CLOSE || curr_tok->type == TOKEN_BRACE_OPEN) {
2170+
upper_bound = i - 1;
2171+
break;
2172+
}
2173+
}
2174+
if (upper_bound < 0) {
2175+
upper_bound = NumTokens - 1;
2176+
}
2177+
2178+
for (i = upper_bound; i > lower_bound; i--)
21662179
{
21672180
tokenInfo * curr_tok;
21682181
curr_tok = prevToken (st, i);

0 commit comments

Comments
 (0)