Replies: 2 comments 3 replies
-
Clever idea (why didn't we think of that before?), but wow that's going to be a lot of macro usage just to appease the formatter and some pack/unpack calls that have custom indent for nested objects will still likely l need to be left alone. This feels to me like it will not be worth it but then I may be a little simplistic in how I approach contributing to other projects (I tend to just try to be a good mimic). |
Beta Was this translation helpful? Give feedback.
2 replies
-
Is there no way to just have clang-format leave functions that match a pattern alone? (e.g. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was reminded of the long-lived search for a way to automate formatting for
flux-core recently, and had an idea as part of dealing with the qmanager stats
PR. The main complication is dealing with
*_(un)?pack
functions, and Irealized there's an interesting corner case there that we don't often see, but
probably should a whole lot more, which is fields that use more than one
argument per item in the format string, this can happen both because of having
sub-objects and because of using string and a length arguments rather than
null-terminated, or even including extra string or string and length segments to
be concatenated.
What would you think of having a set of macros we use to help self-document what
the intention is in these things? Here's a snippet out of the object from the
PR I mentioned as it is auto-indented by clang-format:
This is how I think it would be manually indented:
How would folks feel about doing something vaguely like this:
Clearly more typing, but the contents of that example were auto-formatted with
clang-format. It could be shorter, like just
JS()
or even$JS()
, or haveversions to express what kind of field it is to let us do verification (we could
actually do type-checking with c11 generic macros if anyone cares to do that). It's also just simple enough I think I could write a script to do the re-writing for the vast majority of cases.
@grondo, @garlick, what do you think?
Beta Was this translation helpful? Give feedback.
All reactions