[PATCH v4 01/12] Add .clang-format with defaults matching what's specified in the style guide

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Christophe de Dinechin <dinechin@xxxxxxxxxx>

There are two use cases for this .clang-format:

1. Local reformatting of source code, e.g. using Emacs clang-format.el package.
   This is basically a wawy to accelerate routine reformatting actions during
   heavy editing or refactoring.

2. Global reformatting of the source code, e.g. using the 'make reformat'
   rule in the 'build' makefiles.

Presently, our source code is not entirely ready for this kind of
refactoring yet, mostly because several of our headers are not
self-contained, so you end up with errors like:

    In file included from agent-msg-filter.c:25:
    In file included from ./red-common.h:37:
    In file included from ./spice.h:27:
    ./spice-migration.h:47:31: error: unknown type name 'SpiceServer'

Changes since v3:
- Documented rationale and use cases in commit log
- Some setting changes to more closely match existing server practice

Signed-off-by: Christophe de Dinechin <dinechin@xxxxxxxxxx>
---
 .clang-format | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 .clang-format

diff --git a/.clang-format b/.clang-format
new file mode 100644
index 00000000..56835831
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,30 @@
+Language:        Cpp
+# BasedOnStyle:  LLVM
+
+# The following is commented out until widely supported
+# IncludeBlocks: Regroup
+SortIncludes: true
+
+IncludeCategories:
+  - Regex:           'config.h'
+    Priority:        -1
+  - Regex:           '^"spice.*"'
+    Priority:        1
+  - Regex:           'glib'
+    Priority:        4
+  - Regex:           '^<.*>'
+    Priority:        3
+  - Regex:           '^".*"'
+    Priority:        2
+
+ColumnLimit:     100
+IndentCaseLabels: false
+IndentWidth:     4
+BreakBeforeBraces: Mozilla
+
+BinPackParameters: false
+
+# For global reformatting, should we consider 'true' for these?
+# It helps in many parts of the code but breaks other
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
-- 
2.13.5 (Apple Git-94)

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]