Hi Edwin,
The title should have "OCaml" to clarify that .clang-format is not added
at the root level.
On 30/11/2022 17:32, Edwin Török wrote:
Add a .clang-format configuration that tries to match CODING_STYLE where
possible.
I was not able to express the special casing of braces after 'do'
though, this can only be controlled generally for all control
statements.
It is imperfect, but should be better than the existing bindings, which
do not follow Xen coding style.
Right, from previous discussion, I was under the impression that it
requires some work to write a clang-format file for Xen.
I am hopeful that some day we will have a proper one. In fact, we have
been discussing about this as part of MISRA (+ Stefano).
Add this to tools/ocaml first because:
* there are relatively few C files here, and it is a good place to start with
* it'd be useful to make these follow Xen's CODING_STYLE
(which they currently do not because they use tabs for example)
* they change relatively infrequently, so shouldn't cause issues with
backporting security fixes (could either backport the reindentation
patch too, or use git cherry-pick with `-Xignore-space-change`)
Once this is used it'll need inserting some '#include <stdint.h>', otherwise
xs_wire.h
fails to compile due to the missing uint32_t define.
At first I was a bit concerned with this paragraph because a coding
style should not impact compilation. But I guess that's because the
format will convert u32 to uint32_t. Is that correct?
If so, I would expand the paragraph to explicit say that, per the coding
styel, u32 will be converted to uint32_t.
Cheers,
--
Julien Grall