Digital Trauma
Digital Trauma

Reputation: 16016

indent: space after function name in definition

The code style guidelines I am required to follow mandate:

  1. No space after the function name at function call sites
  2. No space after the function name in function declarations/prototypes
  3. Space after the function name in the function definition

I am trying to achieve this using gnu indent.

By default indent seems to add spaces after the function names in all the above cases.

If I supply the -npcs option, then the spaces are removed in all the above cases.

Is there any way I can get indent to give me spaces in the definition case, but no spaces in all the other cases?

I will also consider alternatives to indent.

Upvotes: 2

Views: 924

Answers (1)

Chris J. Kiick
Chris J. Kiick

Reputation: 1505

Indent does not appear to have those options.

Uncrustify (http://uncrustify.sourceforge.net/) has these options:

sp_func_proto_paren { Ignore, Add, Remove, Force } Add or remove space between function name and '(' on function declaration

sp_func_def_paren { Ignore, Add, Remove, Force } Add or remove space between function name and '(' on function definition

sp_func_call_paren { Ignore, Add, Remove, Force } Add or remove space between function name and '(' on function calls

It also has an associated gui tool : UniversalIndentGUI (http://universalindent.sourceforge.net/index.php).

HTH,

Upvotes: 1

Related Questions