From 5e4be05907e522de2b36868e6dd3e77fe6c0a45d Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Fri, 19 Oct 2018 06:56:30 -0700 Subject: [PATCH] [style] change to clang-format-6.0 (#3222) --- .travis.yml | 5 +++-- CONTRIBUTING.md | 2 +- STYLE_GUIDE.md | 2 +- script/bootstrap | 2 +- script/clang-format.sh | 10 +++++----- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9212dc9b1..9a5821cd2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -84,9 +84,10 @@ matrix: addons: apt: sources: - - llvm-toolchain-trusty-5.0 + - llvm-toolchain-trusty-6.0 + - ubuntu-toolchain-r-test packages: - - clang-5.0 + - clang-format-6.0 - env: BUILD_TARGET="scan-build" CC="clang-6.0" CXX="clang++-6.0" os: linux addons: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 52f6068c4..dcb76ee4c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -112,7 +112,7 @@ This will open up a text editor where you can specify which commits to squash. #### Coding Conventions and Style -OpenThread uses and enforces the [OpenThread Coding Conventions and Style](STYLE_GUIDE.md) on all code, except for code located in [third_party](third_party). Use the `make pretty` and `make pretty-check` targets to automatically reformat code and check for code-style compliance, respectively. OpenThread currently requires [clang-format v5.0.1](http://releases.llvm.org/download.html#5.0.1) for `make pretty` and `make pretty-check`. +OpenThread uses and enforces the [OpenThread Coding Conventions and Style](STYLE_GUIDE.md) on all code, except for code located in [third_party](third_party). Use the `make pretty` and `make pretty-check` targets to automatically reformat code and check for code-style compliance, respectively. OpenThread currently requires [clang-format v6.0.0](http://releases.llvm.org/download.html#6.0.0) for `make pretty` and `make pretty-check`. As part of the cleanup process, you should also run `make pretty-check` to ensure that your code passes the baseline code style checks. diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index a570ea20e..fa8d95a83 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -114,7 +114,7 @@ - OpenThread uses the `make pretty` build target to reformat code and enforce code format and style. The `make pretty-check` build target is included in OpenThread's continuous integration and must pass before a pull request is merged. -- The `make pretty` and `make pretty-check` build targets require [clang-format v5.0.1](http://releases.llvm.org/download.html#5.0.1). +- The `make pretty` and `make pretty-check` build targets require [clang-format v6.0.0](http://releases.llvm.org/download.html#6.0.0). ### File Names - File names should match the names and types of what is described in the file. If a file contains many declarations and definitions, the author should choose the one that predominantly describes or that makes the most sense. diff --git a/script/bootstrap b/script/bootstrap index 112bb3b9a..b2cce371b 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -49,7 +49,7 @@ install_packages_apt() sudo apt-get install gcc-arm-embedded # add clang-format for pretty - sudo apt-get install clang-format-5.0 + sudo apt-get install clang-format-6.0 } install_packages_opkg() diff --git a/script/clang-format.sh b/script/clang-format.sh index ed0993711..fd3454745 100755 --- a/script/clang-format.sh +++ b/script/clang-format.sh @@ -27,25 +27,25 @@ # POSSIBILITY OF SUCH DAMAGE. # -CLANG_FORMAT_VERSION="clang-format version 5.0" +CLANG_FORMAT_VERSION="clang-format version 6.0" die() { echo " *** ERROR: " $* exit 1 } -if which clang-format-5.0 > /dev/null; then - alias clang-format=clang-format-5.0 +if which clang-format-6.0 > /dev/null; then + alias clang-format=clang-format-6.0 elif which clang-format > /dev/null; then case "$(clang-format --version)" in "$CLANG_FORMAT_VERSION"*) ;; *) - die "clang-format 5.0 required" + die "clang-format 6.0 required" ;; esac else - die "clang-format 5.0 required" + die "clang-format 6.0 required" fi clang-format $@