Reputation: 31
I am using uncrustify 0.69.0 (I can't get 0.71.0 to compile yet). I have the following:
sendto(cmd_sock, buf, strlen(buf),
0, (struct sockaddr *)&fromCmd,
sizeof(struct sockaddr_in));
And I want uncrustify to combine them to a single line:
sendto(cmd_sock, buf, strlen(buf), 0, (struct sockaddr *)&fromCmd, sizeof(struct sockaddr_in));
This old 2012 question is similar but existed during a much older version of uncrustify and did not have a solution: Uncrustify Collapse Multiline Function Call Is there a solution today?
2020-07-27- I tried to make a comment but it limited me to mostly nothing of value. So I'm updating my original question.... strange- nl_func_call_args is not found in my config files.... but this is:
# Whether to add a newline after each ',' in a function call if '(' and ')'
# are in different lines.
nl_func_call_args_multi_line = false # true/false
Notice that the options dont allow to "delete". Doing a search in all the config files I have back to .67 does not find nl_func_call_args. if one removes any .uncrustify.cfg and runs uncrustify --update-config one will NOT find nl_func_call_args. When I get a new version of uncrustify I ALWAYS run a default and analyze what changed. This is the only way I can trust the configs. My original question still stands. This is about creating a standard for C code. I see a LOT of crazy function call formatting, especially in recent years. The only way to get it into shape is to FIRST remove all the multiline crap. Then I can edit if needed to a better format. Otherwise I'm editing EVERY STINKING line. For the record I have been writing C since 1981 and almost 100% adhere to K&R. I have a handful of deviations. I also use VI so ALL of the format features that were in the original VI I still want code to adhere to so this editor will work properly. regards oldunixguy
Upvotes: 1
Views: 499
Reputation: 181
# Add or remove newline after each ',' in a function call.
nl_func_call_args = remove # ignore/add/remove/force
That option was introduced on 2016-06-27 (796b5ba5)
Upvotes: 0