bug-indent
[Top][All Lists]
Advanced

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

indent -vs- GCC-specific control flow macros


From: Tom Tromey
Subject: indent -vs- GCC-specific control flow macros
Date: Thu, 20 Dec 2007 10:50:39 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.990 (gnu/linux)

I'm using GNU indent 2.2.9 on Fedora 8.

I'm investigating using indent to set the canonical style for GCC.

GCC has several macros that it uses widely which confuse indent.
Before we could use indent we would need some solution to this
problem.

The previous post on this topic was concerned with macros applied to
declarations.  This one concerns control-flow macros.

GCC has a few macros which expand to loop headers.  For instance,
there is the "FOR_EACH_BB" macro, which iterates over basic blocks.
We'd like these to be indented like 'for' loops:

  FOR_EACH_BB (bb)
    {
      if (probably_never_executed_bb_p (bb))
        BB_SET_PARTITION (bb, BB_COLD_PARTITION);
      ...
    }

However, we currently get weird results.  With the above the only
problem is that the braces are misplaced:

  FOR_EACH_BB (bb)
  {
    if (probably_never_executed_bb_p (bb))
      BB_SET_PARTITION (bb, BB_COLD_PARTITION);
    ...
  }

However if the body of the loop is not braced, much of the body ends
up on the same line as the FOR_EACH_BB.

Tom




reply via email to

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