www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Lack <gml4...@ggr.co.uk>
Subject mod_include/3006: Compiler complains about end-of-loop code not reached.
Date Tue, 15 Sep 1998 10:57:01 GMT

>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
>Originator:     gml4410@ggr.co.uk
>Release:        1.3.1
Solaris 2.6 - Compiler Sun 4.0.1

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:


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.
[In order for any reply to be added to the PR database, ]
[you need to include <apbugs@Apache.Org> 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.  

View raw message