Thanks to work done in the NetBSD clang-format project.
Details
Details
- Reviewers
emaste markj - Commits
- rS362590: Update .clang-format with style(9) header-sorting
Example 1:
--- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -34,105 +34,89 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include "opt_param.h" -#include "opt_mbuf_stress_test.h" #include "opt_mbuf_profiling.h" +#include "opt_mbuf_stress_test.h" +#include "opt_param.h" #include <sys/param.h> -#include <sys/systm.h> +#include <sys/domain.h> #include <sys/kernel.h> #include <sys/limits.h> #include <sys/lock.h> #include <sys/malloc.h> #include <sys/mbuf.h> -#include <sys/sysctl.h> -#include <sys/domain.h> #include <sys/protosw.h> +#include <sys/sdt.h> +#include <sys/sysctl.h> +#include <sys/systm.h> #include <sys/uio.h> #include <sys/vmmeter.h> -#include <sys/sdt.h> + #include <vm/vm.h> -#include <vm/vm_pageout.h> #include <vm/vm_page.h> +#include <vm/vm_pageout.h>
Example 2:
--- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -39,12 +39,12 @@ __FBSDID("$FreeBSD$"); #include "opt_stack.h" #include <sys/param.h> -#include <sys/systm.h> #include <sys/bus.h> -#include <sys/cons.h> /* cngetc() */ +#include <sys/cons.h> /* cngetc() */ #include <sys/cpuset.h> #include <sys/csan.h> -#ifdef GPROF +#include <sys/systm.h> +#ifdef GPROF #include <sys/gmon.h> #endif #include <sys/kdb.h> @@ -61,32 +61,33 @@ __FBSDID("$FreeBSD$"); #include <sys/sysctl.h> #include <vm/vm.h> -#include <vm/vm_param.h> #include <vm/pmap.h> -#include <vm/vm_kern.h> #include <vm/vm_extern.h> +#include <vm/vm_kern.h> #include <vm/vm_map.h> +#include <vm/vm_param.h> -#include <x86/apicreg.h> #include <machine/clock.h> #include <machine/cpu.h> #include <machine/cputypes.h> -#include <x86/mca.h> #include <machine/md_var.h> #include <machine/pcb.h> #include <machine/psl.h> #include <machine/smp.h> #include <machine/specialreg.h> #include <machine/stack.h> + +#include <x86/apicreg.h> +#include <x86/mca.h> #include <x86/ucode.h>
Any objections to the reordering, or suggestions for other test cases?
Diff Detail
Diff Detail
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 31928 Build 29479: arc lint + arc unit
Event Timeline
Comment Actions
I'm not sure off hand of other representative test cases - most likely we can just find them from user feedback as folks start using this.
Comment Actions
(This is definitely not a complete style(9) .clang-format; the working goal is "less wrong than it was before.")
Comment Actions
This seems reasonable to me. Thanks for doing it.
.clang-format | ||
---|---|---|
105 | I think it should be just `^<(fs|nfs|nfsclient|nfsserver|ufs)/'. |
Comment Actions
This is very nice to have codified, although I personally think our header ordering requirements are atrocious. ;-)