bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

--cuddle-else removes empty line after if


From: Håkon A. Hjortland
Subject: --cuddle-else removes empty line after if
Date: Tue, 13 May 2008 01:45:24 +0200
User-agent: Thunderbird 2.0.0.14 (X11/20080505)

Example code:
----------------------------------------
int
main ()
{
  if (1)
    {
    }

  //
  return 0;
}
----------------------------------------

Running "indent --cuddle-else" removes the empty line after "if":
----------------------------------------
$ indent --cuddle-else a.c -o b.c
$ diff -u a.c b.c
--- a.c 2008-05-13 01:30:57.000000000 +0200
+++ b.c 2008-05-13 01:31:08.000000000 +0200
@@ -16,7 +16,6 @@
   if (1)
     {
     }
-
   //
   return 0;
 }
----------------------------------------

Expected result:
The line should not be removed.

It seems all these conditions must be met for the bug to appear:
1) --cuddle-else option used
2) "if" with braces and without "else"
3) Followed by one or more empty lines, then a "//"-comment
If there is more than one empty line, only one will be removed.

--
Håkon






reply via email to

[Prev in Thread] Current Thread [Next in Thread]