I'm trying to determine the correct set of options to handle comments
to the left of preprocessor statements, the handling of comments on an
#endif seems to be "broken", or I'm not getting the right combination
of options.

Given the following source:
---
#include <stdio.h>
#if defined(bar) /* BAR */
#ifdef foo /* FOO */
#include <stdlib.h> /* Inc 1 */
#endif /* foo */
#else /* defined foo */
#if define(foo) /* defined FOO */
#include <stdlib.h> /* Inc 2 */
#endif /* defined foo */
#endif /* bar */
int
main (int argc, char **argv)
{
  return 0;
}
---
and running:

indent -gnu -ppi1 -cp1

produces the following:

---
#include <stdio.h>
#if defined(bar) /* BAR */
# ifdef foo /* FOO */
#  include <stdlib.h> /* Inc 1 */
# endif/* foo */
#else /* defined foo */
# if define(foo) /* defined FOO */
#  include <stdlib.h> /* Inc 2 */
# endif/* defined foo */
#endif /* bar */
int
main (int argc, char **argv)
{
  return 0;
}
---
Notice the lack of space between the indented #endif and the comment comment.

Another issue I've seen is where the comment is split into its own line.

What I really would like to have done is a space after the #endif of
#else and its commit  regardless of the indentation of the
preprocessor statement.

Cheyenne Wills

Reply via email to