aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2016-05-05 17:17:59 +0100
committerDaniel Thompson <daniel.thompson@linaro.org>2016-05-05 17:17:59 +0100
commit10f7f5b76cc4a76dc6065c2fb665ee13344d0bf5 (patch)
treede57272c8b68e667965a7ddfbabbe16ce2a49134
parenta8d302f9abe6bbb5daceafaeae7cdb1804d14d59 (diff)
Add .clang-format description of openocd coding styledev/clang-format
Currently openocd does not support hackers who want to use clang-format to work on openocd. This patch fixes that by adding a description of the openocd coding style. clang-format is a tool to format source code. It is able to work on a subset of the file (for example an editor macro can be written to reformat only the line currently under the cursor). This allows automatic formatting to become part of a developers workflow *without* spamming the VCS with pointless whitespace changes! Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
-rw-r--r--.clang-format25
1 files changed, 25 insertions, 0 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 00000000..e70f8126
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,25 @@
+#
+# openocd coding style
+#
+
+
+# The LLVM style is extremely dense, both vertically and
+# horizontally. To get a full summary of what the base style includes
+# try:
+# clang-format -style=llvm -dump-config
+BasedOnStyle: LLVM
+
+# These are not explicit stated in the documentation but most of the
+# code in the repo follows this form.
+AllowShortIfStatementsOnASingleLine: false
+BreakBeforeBraces: Linux
+
+# "use TAB characters for indentation; do NOT use spaces"
+UseTab: Always
+
+# "displayed TAB width is 4 characters"
+IndentWidth: 4
+TabWidth: 4
+
+# "try to avoid lines of code that are longer than than 72-80 columns"
+ColumnLimit: 80