Patch: PR 4509
Tom Tromey
tromey@redhat.com
Thu Dec 20 21:28:00 GMT 2001
>>>>> "Per" == Per Bothner <per@bothner.com> writes:
Per> You might add a comment that "this can only legally be
Per> unreachable in the case of a do-while" or words to that effect.
Ok, I'll do that.
Tom> I'm not completely sure the new code is correct, since I don't
Tom> understand why the old code was written the way it was.
Per> I believe the reason was to avoid cascading error messages. I.e. for:
Per> break;
Per> stmt1;
Per> stmt2;
Thanks for the info. I tried this program with my patch applied, and
I only get a single message:
public class q
{
public static void main (String[] args)
{
do
{
break;
System.out.println ("x");
System.out.println ("y");
}
while (true);
}
}
creche. gcj -C q.java
q.java: In class `q':
q.java: In method `q.main(java.lang.String[])':
q.java:8: Unreachable statement.
System.out.println ("x");
^
1 error
Per> So your change here is only ok if you make sure this doesn't
Per> happen.
Ok, thanks.
Tom
More information about the Java-patches
mailing list