Re: [Bug-indent] bug report - bogus unmatched else report

From:

david ingamells

Subject:

Re: [Bug-indent] bug report - bogus unmatched else report

Date:

Tue, 15 Jan 2002 20:53:58 +0100

Harry,
People seem to expect a lot of poor old indent. Not only does it have to
recognise K+R C and ANSI/ISO-89 standard C, it is also expected to be able to
understand all the mangling of the language that people can wring out of the
pre-processor.
To poor old indent ALLPAD_LOOP is just a function, and functions are not
allowed to contain if statements. This behaviour of indent will take a major
effort to change and is probably sufficiently large to make a university
post-graduate research project. I cannot see it happening!
I might point out that (regardless of how indent handles them) such macros
are also the source of all sorts of weird compilation or execution bugs when
an extra comma or a missing semicolon slip in. They are also very difficult
to step through in a debugger.
On Tuesday 08 January 2002 11:41 pm, harry eaton wrote:
> The (small) attached c file causes indent version 2.2.7 to
> give an erroneous report:
>
> indent: test.c:14: Error:Unmatched 'else'
>
> Clearly the else is in regards to the 'if' on line 12.
> Before I paired down the source to a small example, this
> line of code was actually on line 754, but was reported
> as being on line 647. If you request, I will send the larger
> file so you can see this too.
>
> Note that ALLPAD_LOOP(x,y) is a macro defined in
> the include file. The macro looks more-or-less like:
>
> #define ALLPAD_LOOP(x,y) { int n; for (n=0; n<5; n++) { padtype pad =
> x->pad; y; } }
>
> Thanks,
> harry eaton
--
David Ingamells
address@hidden
(0031) +13 5093388 (home)
(0031) +13 065010947 (mobile)