2.2.10 has a broken -bad or –blank-lines-after-declarations
In 2.2.10 -bad puts a blank line after every individual declaration
statement instead of at the end of the last one as prior versions did.
This update is apparently the cause:
* - 28 Sep 2003 Erik de Castro Lopo
* Fixed Bug#212320: --blank-lines-after-procedures does not work
The code block that was completed disabled in indent.c by "#if 0" should
be re-enabled,
then the attached patch applied to allow both -bad and -bap to work.
Test case:
------------------------
int test()
{
int i;
char *p;
i = rnd(10);
for (k=1; k < 10; ++k) {
int j=2;
int l=1;
j=i+j;
j=j+l;
}
}
int func1 (void)
{
return 42;
}
static int func2 (void)
{
return 43 ;
}
------------------------
Results with indent 2.2.10 -bad -bap:
int
test ()
{
int i;
char *p;
i = rnd (10);
for (k = 1; k < 10; ++k)
{
int j = 2;
int l = 1;
j = i + j;
j = j + l;
}
}
int
func1 (void)
{
return 42;
}
static int
func2 (void)
{
return 43;
}
------------------------
Results after attached patch with indent 2.2.10 -bad -bap:
int
test ()
{
int i;
char *p;
i = rnd (10);
for (k = 1; k < 10; ++k)
{
int j = 2;
int l = 1;
j = i + j;
j = j + l;
}
}
int
func1 (void)
{
return 42;
}
static int
func2 (void)
{
return 43;
}
*** indent-2.2.10-orig/src/indent.c Tue Dec 09 22:08:00 2014
--- indent-2.2.10/src/indent.c Tue Dec 09 22:46:09 2014
***************
*** 47,52 ****
--- 47,54 ----
* - 28 Sep 2003 Geoffrey Lee <g...@bogus.example.com>
* Fixed Bug#205692: indent: [patch] fix garble shown in
locale(fwd)
* - 2008-03-08 DI Re-baselined on the more acceptable (license-wise) OpenBSD
release 3.4.
+ * - 2014-12-09: M. Allison
+ * The 2003 fix for -bap broke -bad. Make both work.
*/
#include "sys.h"
***************
*** 1600,1606 ****
}
}
! #if 0
/* Erik de Castro Lopo Sun, 28 Sep 2003:
* I don't know what this is supposed to do, but I do know that it
* breaks the operation of the blanklines_after_procs setting in
--- 1602,1608 ----
}
}
! #if 1
/* Erik de Castro Lopo Sun, 28 Sep 2003:
* I don't know what this is supposed to do, but I do know that it
* breaks the operation of the blanklines_after_procs setting in
***************
*** 1622,1627 ****
--- 1624,1630 ----
*/
if (prefix_blankline_requested &&
+ prefix_blankline_requested_code != rbrace &&
((parser_state_tos->block_init != 0) ||
(parser_state_tos->block_init_level != -1) ||
(parser_state_tos->last_token != rbrace) ||
_______________________________________________
bug-indent mailing list
bug-indent@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-indent