bug-indent
[Top][All Lists]
Advanced

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

[Bug-indent] Unmatched 'else' bug with casts


From: Peter Moulder
Subject: [Bug-indent] Unmatched 'else' bug with casts
Date: Fri, 01 Feb 2002 13:49:20 +1100

  $ indent --version
  GNU indent 2.2.7
  $ cat tstg.i
  int
  f (int i)
  {
    if (i)
      return (int) i * (int) i;
    else
      return 0;
  }
  $ indent < tstg.i 
  int
  f (int i)
  {
    if (i)
      return (int) i *(int) i;
  indent: Standard input:6: Error:Unmatched 'else'
    else
    return 0;
  }
  $ gcc -c -Wall tstg.i && echo "Valid C code"
  Valid C code
  $

The above example shows indent giving an error (and incorrect output
formatting) for valid C code, which is a bug.

The problem seems to be related to the cast.  Note also that `*' has
been output as if it were a unary operator.

pjm.




reply via email to

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