On Wed, Sep 12, 2018 at 11:58:20AM +0800, Shi Lei wrote:
Signed-off-by: Shi Lei <shi_lei@xxxxxxxxxxxxxx> --- cfg.mk | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cfg.mk b/cfg.mk index 609ae86..a43cb1c 100644 --- a/cfg.mk +++ b/cfg.mk @@ -702,6 +702,17 @@ sc_preprocessor_indentation: echo '$(ME): skipping test $@: cppi not installed' 1>&2; \ fi +# Use 4 spaces rather than TAB for indentation for those top-level +# function bodies. Doesn't catch all cases, but it helps. +sc_indentation_for_function_body: + @for f in $$($(VC_LIST_EXCEPT) | grep -E '\.[ch](\.in)?$$'); do \
Doing it this way is very inefficient. This spawns 5 greps and one sed for each .c file. It might be bearable for spec files, when we only have two, but we have nearly a thousand .c and .h files I spent quite some time on making syntax-check as fast as possible, to encourage people to run it more often. Adding this to build-aux/check-spacing.pl would let you take advantage of the existing code for opening the files and get rid of all the line number regexes, making the check more readable. Also, it would let you split the error message and only output the relevant one. Grouping indentation and empty lines in one error message is not very friendly.
+ grep -n -A1 '^{$$' $$f | grep '^[0-9]\{1,\}-' \ + | grep -v '^[0-9]\{1,\}-[ ]\{4\}\S' |
grep -v '^[0-9]\{1,\}-\([#}/]\|.*:\)' \
There is no need to exempt '/', the following is also wrong: src/qemu/qemu_domain_address.c:2303:/* Try to find a nice default for busNr for a new pci-expander-bus. Jano
+ | $(SED) -ne "s#\(^[0-9]\{1,\}\)-#$$f:\1:#gp" | grep . && \ + { echo '$(ME): incorrect indentation or empty for first line in function body' 1>&2; \ + exit 1; } \ + done || : + # Enforce similar spec file indentation style, by running cppi on a # (comment-only) C file that mirrors the same layout as the spec file. sc_spec_indentation: -- 2.17.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list