gplugin/gplugin
Clone
Summary
Browse
Changes
Graph
Adjust .clang-format to sort includes
bugfix/clang-format-tweaks
2020-02-26, Richard Laager
c96214250615
Parents
35d014373e86
Children
2afe9b045950
Adjust .clang-format to sort includes
This sorts includes the way we want.
1 files changed, 45 insertions(+), 7 deletions(-)
+45
-7
.clang-format
--- a/.clang-format Wed Feb 26 04:03:12 2020 -0600
+++ b/.clang-format Wed Feb 26 13:55:23 2020 -0600
@@ -64,14 +64,52 @@
- foreach
- Q_FOREACH
- BOOST_FOREACH
-IncludeBlocks: Preserve
+# With clang-format-11, change:
+IncludeBlocks: Preserve
+#IncludeBlocks: Regroup
IncludeCategories:
- - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
- Priority: 2
- - Regex: '^(<|"(gtest|gmock|isl|json)/)'
- Priority: 3
- - Regex: '.*'
- Priority: 1
+ # We do not use many local headers, but when used, we order them first,
+ # rather than the popular convention of last. This is important for the
+ # Perl loader, where we need to ensure that all (indirect) includes of
+ # gperl.h occur before all includes of glib, due to the conflict in the _
+ # macro.
+ - Regex: '^"'
+ Priority: 10
+ # C system headers.
+ - Regex: '^[<"](aio|arpa/inet|assert|complex|cpio|ctype|curses|dirent|dlfcn|errno|fcntl|fenv|float|fmtmsg|fnmatch|ftw|glob|grp|iconv|inttypes|iso646|langinfo|libgen|limits|locale|math|monetary|mqueue|ndbm|netdb|net/if|netinet/in|netinet/tcp|nl_types|poll|pthread|pwd|regex|sched|search|semaphore|setjmp|signal|spawn|stdalign|stdarg|stdatomic|stdbool|stddef|stdint|stdio|stdlib|stdnoreturn|string|strings|stropts|sys/ipc|syslog|sys/mman|sys/msg|sys/resource|sys/select|sys/sem|sys/shm|sys/socket|sys/stat|sys/statvfs|sys/time|sys/times|sys/types|sys/uio|sys/un|sys/utsname|sys/wait|tar|term|termios|tgmath|threads|time|trace|uchar|ulimit|uncntrl|unistd|utime|utmpx|wchar|wctype|wordexp)\.h[">]$'
+ Priority: 20
+ # glib headers
+ - Regex: '^<glib\.h>'
+ Priority: 30
+ - Regex: '^<(glib-|gmodule)'
+ # With clang-format-11, change:
+ Priority: 31
+ #Priority: 30
+ #SortPriority: 31
+ - Regex: '^<(gio/|glib/|gobject/)'
+ # With clang-format-11, change:
+ Priority: 32
+ #Priority: 30
+ #SortPriority: 32
+ # GTK headers
+ - Regex: '^<gtk/'
+ Priority: 40
+ # gplugin headers
+ - Regex: '^<gplugin\.h>'
+ Priority: 50
+ - Regex: '^<gplugin-'
+ # With clang-format-11, change:
+ Priority: 51
+ #Priority: 50
+ #SortPriority: 51
+ - Regex: '^<gplugin/'
+ # With clang-format-11, change:
+ Priority: 52
+ #Priority: 50
+ #SortPriority: 52
+ # Other libraries' headers
+ - Regex: '^<'
+ Priority: 60
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: true
IndentPPDirectives: None