1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

Patch for Devin Steffler.

Bug 98328 	[Content Assist] infinite loop encountered in C projects (related to K&R C parameters)
This commit is contained in:
John Camelon 2005-06-06 15:52:15 +00:00
parent 8a37c61a8c
commit 6d35ccf9b4

View file

@ -2586,8 +2586,14 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
// look ahead for the start of the function body, if end of file is // look ahead for the start of the function body, if end of file is
// found then return 0 parameters found (implies not KnR C) // found then return 0 parameters found (implies not KnR C)
IToken previous=null;
IToken next=null;
while (LT(1) != IToken.tLBRACE) { while (LT(1) != IToken.tLBRACE) {
consume(); next = consume();
if (next == previous) { // infinite loop detected
break;
}
previous = next;
} }
backup(mark); backup(mark);
@ -2612,8 +2618,15 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
// consume until LBRACE is found (to leave off at the function body and // consume until LBRACE is found (to leave off at the function body and
// continue from there) // continue from there)
while (LT(1) != IToken.tLBRACE) IToken previous=null;
consume(); IToken next=null;
while (LT(1) != IToken.tLBRACE) {
next = consume();
if (next == previous) { // infinite loop detected
break;
}
previous = next;
}
return pd; return pd;
} }