Re: Bug with case labels

Lynn Kerby <[email protected]>
Newsgroups gmane.comp.gnu.indent.bugs
Message-ID <[email protected]>
On Sep 22, 2006, at 2:21 AM, Prakhar Deep wrote:
> switch(c)
> {
> case 1:
> {
>
> }
> 	PREFIX
> case2:
> SUFFIX
> {
>
> }
>
> }
>
> We ran indent with following options: -kr -ts4 -l120 -bad -nbbo -br 
> -nce -nbfda -nut

Prakhar,

I did a little investigation and the problem of successive runs 
changing the file seems to be triggered by the -kr option (or more 
correctly some setting that is modified by that option).  When -kr was 
removed, the output was constant.

However,....

I don't believe indent can or should handle this code as it is not 
technically legal C (or C++) IMO.  I am assuming that PREFIX and SUFFIX 
are some preprocessor definitions that evaluate to legal statements, 
but indent is not aware of their expansions.  If I add terminators to 
both PREFIX and SUFFIX, the output is constant (confused, but 
constant).

If someone can convince me that indent *should* support this syntax 
(please include reference to C spec or GNU extension document) then I 
might consider it a bug.

Lynn Kerby
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.