indent -br, -bl options, different number of lines for if (long_conditions) //comment

Andrei DAMIAN-FEKETE <[email protected]> Thu, 12 Nov 2009 14:42:45 -0800 (PST)
Newsgroups gmane.comp.gnu.indent.bugs
Message-ID <[email protected]>
Hello,

I've tried to indent (GNU indent 2.2.10, Windows) something like this:

int
main ()
{
  if (StrCmpNI (aaaaaaaaaaaaaaaaaaaaaaaaaaaaa == 0
		|| bbbbbbbbbbbbbbbbbbbbbbbbb == 2
		|| ccccccccccccccccccccccccccs (dddd)
		|| eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee))	// a comment
  {
    x ();
  }
  if (a > 0) {
    y ();
  }

}

Using -br I've got:
int
main ()
{
  if (StrCmpNI (aaaaaaaaaaaaaaaaaaaaaaaaaaaaa == 0
		|| bbbbbbbbbbbbbbbbbbbbbbbbb == 2
		|| ccccccccccccccccccccccccccs (dddd)
		|| eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee))	// a comment
  {
    x ();
  }
  if (a > 0) {
    y ();
  }

}

and using -bl -bli0 I've got:
int
main ()
{
  if (StrCmpNI (aaaaaaaaaaaaaaaaaaaaaaaaaaaaa == 0 || bbbbbbbbbbbbbbbbbbbbbbbbb == 2 || ccccccccccccccccccccccccccs (dddd) || eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee))	// a comment
  {
    x ();
  }
  if (a > 0)
  {
    y ();
  }

}

Also using again the -br option on the "-bl -bli0" output doesn't change the if condition (it stays on just one line).

It would be nice to have -bl break the if condition on multiple lines or at least keep multiple lines if they are already present (in this case where there is a comment following "if").


I'll put here a diff in case the message gets distorted:

--- E:/a.c.bl	Fri Nov 13 00:34:44 2009
+++ E:/a.c.br	Fri Nov 13 00:34:37 2009

@@ -1,13 +1,15 @@
 int
 main ()
 {
-  if (StrCmpNI (aaaaaaaaaaaaaaaaaaaaaaaaaaaaa == 0 || bbbbbbbbbbbbbbbbbbbbbbbbb == 2 || ccccccccccccccccccccccccccs (dddd) || eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee))	// a comment
+  if (StrCmpNI (aaaaaaaaaaaaaaaaaaaaaaaaaaaaa == 0
+		|| bbbbbbbbbbbbbbbbbbbbbbbbb == 2
+		|| ccccccccccccccccccccccccccs (dddd)
+		|| eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee))	// a comment
   {
     x ();
   }
-  if (a > 0)
-  {
+  if (a > 0) {
     y ();
   }
 
 }


Thank you for your time,
Andrei


--