In particular, header file ordering is an issue in the tools/perf
directory given the larger number of depended upon libraries.
The order of header file includes was proposed in:
https://lore.kernel.org/linux-perf-users/CAP-5=fUitzKwJONTngiW17XkS7kVr2cDS4cDL_HccJKcnR2EgQ@mail.gmail.com/
Sorting headers is desirable to avoid issues like duplicate includes.
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Bill Wendling <morbo@google.com>
Cc: Joe Perches <joe@perches.com>
Cc: Justin Stitt <justinstitt@google.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
--- /dev/null
+BasedOnStyle: InheritParentConfig
+SortIncludes: true
+IncludeBlocks: Regroup
+IncludeCategories:
+ # Implicitly the corresponding header for the C file has Priority 0
+ # C Standard Library Headers
+ - Regex: '^<(assert|complex|ctype|errno|fenv|float|inttypes|iso646|limits|locale|math|setjmp|signal|stdalign|stdarg|stdatomic|stdbool|stddef|stdint|stdio|stdlib|stdnoreturn|string|tgmath|threads|time|uchar|wchar|wctype)\.h>'
+ Priority: 1
+ # OS/System-Specific Headers (directories)
+ - Regex: '^<(sys|linux|asm|arpa|net|netinet|x86_64|machine)/.*>'
+ Priority: 2
+ # OS/System-Specific Headers (POSIX/System flat headers)
+ - Regex: '^<(unistd|pthread|fcntl|dirent|dlfcn|poll|sched|semaphore|spawn|syslog|termios|pwd|grp|netdb|sysexits|err|paths|pty|utmp|resolv|ifaddrs|elf|libelf|gelf)\.h>'
+ Priority: 2
+ # Third-Party Library Headers
+ - Regex: '^<.*>'
+ Priority: 3
+ # Your Project's Other Headers
+ - Regex: '^".*"'
+ Priority: 4