[clang-format] update to clang-format-10 (#580)
diff --git a/.clang-format b/.clang-format
index b5b25e7..dce55a8 100644
--- a/.clang-format
+++ b/.clang-format
@@ -20,7 +20,8 @@
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: false
-BraceWrapping:
+BraceWrapping:
+ AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 25f1815..a8c90bd 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -41,7 +41,7 @@
if: "github.ref != 'refs/heads/master'"
pretty:
- runs-on: ubuntu-18.04
+ runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Bootstrap
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9a39466..9e6b4f7 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -109,7 +109,7 @@
#### 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 `script/make-pretty` and `script/make-pretty check` 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 C/C++ and [yapf](https://github.com/google/yapf) for Python.
+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 `script/make-pretty` and `script/make-pretty check` to automatically reformat code and check for code-style compliance, respectively. OpenThread currently requires [clang-format v10.0.0](http://releases.llvm.org/download.html#10.0.0) for C/C++ and [yapf](https://github.com/google/yapf) for Python.
As part of the cleanup process, you should also run `script/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 935a032..68f6edb 100644
--- a/STYLE_GUIDE.md
+++ b/STYLE_GUIDE.md
@@ -111,7 +111,7 @@
- OpenThread uses `script/make-pretty` to reformat code and enforce code format and style. `script/make-pretty check` is included in OpenThread's continuous integration and must pass before a pull request is merged.
-- `script/make-pretty` requires [clang-format v6.0.0](http://releases.llvm.org/download.html#6.0.0) for C/C++ and [yapf](https://github.com/google/yapf) for Python.
+- `script/make-pretty` requires [clang-format v10.0.0](http://releases.llvm.org/download.html#10.0.0) for C/C++ and [yapf](https://github.com/google/yapf) for Python.
### File Names
diff --git a/script/clang-format b/script/clang-format
index 2624ece..addb7fa 100755
--- a/script/clang-format
+++ b/script/clang-format
@@ -27,7 +27,7 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-CLANG_FORMAT_VERSION="clang-format version 6.0"
+CLANG_FORMAT_VERSION="clang-format version 10.0"
die()
{
@@ -39,18 +39,18 @@
# expand_aliases shell option is set using shopt.
shopt -s expand_aliases
-if command -v clang-format-6.0 >/dev/null; then
- alias clang-format=clang-format-6.0
+if command -v clang-format-10 >/dev/null; then
+ alias clang-format=clang-format-10
elif command -v clang-format >/dev/null; then
case "$(clang-format --version)" in
"$CLANG_FORMAT_VERSION"*) ;;
*)
- die "$(clang-format --version); clang-format 6.0 required"
+ die "$(clang-format --version); clang-format 10.0 required"
;;
esac
else
- die "clang-format 6.0 required"
+ die "clang-format 10.0 required"
fi
clang-format "$@" || die
diff --git a/tests/scripts/bootstrap.sh b/tests/scripts/bootstrap.sh
index 1295671..9442341 100755
--- a/tests/scripts/bootstrap.sh
+++ b/tests/scripts/bootstrap.sh
@@ -126,7 +126,7 @@
fi
if [ "$BUILD_TARGET" == pretty-check ]; then
- sudo apt-get install -y clang-format-6.0 shellcheck
+ sudo apt-get install -y clang-format-10 shellcheck
sudo snap install shfmt
fi