>Number: 3006
>Category: mod_include
>Synopsis: Compiler complains about end-of-loop code not reached.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: apache
>State: open
>Class: sw-bug
>Submitter-Id: apache
>Arrival-Date: Tue Sep 15 04:00:01 PDT 1998
>Last-Modified:
>Originator: [EMAIL PROTECTED]
>Organization:
apache
>Release: 1.3.1
>Environment:
Solaris 2.6 - Compiler Sun 4.0.1
>Description:
This looks as though it has alreays been reported in PR#681. However,
the report for that claims that it is a bogus warning. In the code I am
looking at it is not bogus. It affects 2 loops, staring at lines 1436
and 1558.
Taking the 1436 one:
>How-To-Repeat:
>Fix:
If this *is* supposed to be traversing a list, the current has to be updated
somewhere in this loop, and the loop continue'd.
If it isn't, then the "while" should become an "if"., to avoid confusion.
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <[EMAIL PROTECTED]> in the Cc line ]
[and leave the subject line UNCHANGED. This is not done]
[automatically because of the potential for mail loops. ]
[If you do not include this Cc, your reply may be ig- ]
[nored unless you are responding to an explicit request ]
[from a developer. ]
[Reply only with text; DO NOT SEND ATTACHMENTS! ]
>> while (current != (struct parse_node *) NULL) {
Looks like we are going through a linked list...
>> switch (current->token.type) {
>> case token_not:
>> <<other cases, including default>>
>> } /* End of switch */
>> break;
So this break exits the while loop. It will do so on the first pass:
always. So it isn't a loop at all! In fact the "while" is acting just
as an "if".
The while loop starting at line 1387 is a similar structure, but has a
continue in it after moving current along the list.