Skip to content

Commit

Permalink
[style] change to clang-format-6.0 (openthread#3222)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwhui committed Oct 29, 2018
1 parent dcc9b7e commit 5e4be05
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion STYLE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
10 changes: 5 additions & 5 deletions script/clang-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@

0 comments on commit 5e4be05

Please sign in to comment.