summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-10-11 13:54:58 -0700
committerWilliam A. Kennington III <wak@google.com>2018-10-12 01:03:42 -0700
commitb7c49b22ccb82add7874b30cd96931b0f19b20e0 (patch)
tree0e6b1fb1853d5a0201c678e169cdb70764d6be30
parent93c8edc9a030ebd2385eb652d7b049f9181d9c3e (diff)
downloadphosphor-mboxbridge-b7c49b22ccb82add7874b30cd96931b0f19b20e0.tar.gz
phosphor-mboxbridge-b7c49b22ccb82add7874b30cd96931b0f19b20e0.zip
format-code: Use the provided clang format
Other projects use the provided from the unit-test environment building the project. Lets do the same here but fall back to our expected version 6.0 if no CLANG_FORMAT variable is provided. This removes clang-format-5.0 since it is not consistent with the rules enforce by clang-format-6.0. Tested: Ran through unit test suite. Change-Id: If5a137d3981cf0896a426b98c78e1788ec029bf2 Signed-off-by: William A. Kennington III <wak@google.com>
-rwxr-xr-xformat-code.sh11
1 files changed, 3 insertions, 8 deletions
diff --git a/format-code.sh b/format-code.sh
index bd5659c..b3ddcf6 100755
--- a/format-code.sh
+++ b/format-code.sh
@@ -6,14 +6,9 @@ set -x
[ -f .clang-format ] && rm .clang-format
-for cf in clang-format-6.0 clang-format-5.0
-do
- CLANG_FORMAT="$(which ${cf})"
- if [ -n "${CLANG_FORMAT}" ]
- then
- break;
- fi
-done
+# Use the provided clang-format, only define a version
+# if we don't have one provided already
+export CLANG_FORMAT="${CLANG_FORMAT:-clang-format-6.0}"
# phosphor-mboxd is a fork of mboxbridge, the reference mbox daemon
# implementation. mboxbridge is C written with the style of the Linux kernel.
OpenPOWER on IntegriCloud