开发者

How to make Uncrustify force blank lines between functions?

I've been working on my uncrustify config for a few hours now and I'm very close to having it the way I need it. However, I can't find an option to control newlines between function bodies. Uncrustify always removes blank lines between functions, but I'd like to enforce one blank line. Currently I get this:

Input:

void foo() {
  std::cout << "foo!" << std::endl;
}

void bar() {
  std::cout << "bar!" << std::endl;
}

Output:

void foo() {
  std::cout << "foo!" << std::endl;
}
void bar() {
  std::cout << "bar!" << std::endl;
}

In my case, I'd l开发者_高级运维ike to preserve (force!) the blank line in the input. Is there an option to control this?


Epiphany - I was miscounting 'newlines'. The configuration option for this is:

# The number of newlines after '}' of a multi-line function body
nl_after_func_body                       = 2        # number

I originally set this to 1. However, Uncrustify includes the newline on the line containing the brace (}). Setting this to 2 gives the desired result.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜