mirror of
https://github.com/espressif/openthread.git
synced 2026-08-13 22:27:47 +00:00
[code-style] require clang-format-5.0 (#2645)
This commit is contained in:
+1
-1
@@ -357,7 +357,7 @@ fi
|
||||
# Code style
|
||||
#
|
||||
|
||||
AC_SUBST(PRETTY, ["clang-format"])
|
||||
AC_SUBST(PRETTY, ["\${abs_top_srcdir}/script/clang-format.sh"])
|
||||
AC_SUBST(PRETTY_ARGS, ["-style=file -i"])
|
||||
AC_SUBST(PRETTY_CHECK, ["\${abs_top_srcdir}/script/clang-format-check.sh"])
|
||||
AC_SUBST(PRETTY_CHECK_ARGS, [""])
|
||||
|
||||
@@ -47,6 +47,9 @@ install_packages_apt()
|
||||
sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
|
||||
sudo apt-get update
|
||||
sudo apt-get install gcc-arm-embedded
|
||||
|
||||
# add clang-format for pretty
|
||||
sudo apt-get install clang-format-5.0
|
||||
}
|
||||
|
||||
install_packages_opkg()
|
||||
|
||||
@@ -33,14 +33,9 @@
|
||||
# replacements.
|
||||
#
|
||||
|
||||
die() {
|
||||
echo " *** ERROR: " $*
|
||||
exit 1
|
||||
}
|
||||
|
||||
set -x
|
||||
|
||||
# from `man diff`:
|
||||
# Exit status is 0 if inputs are the same, 1 if different, 2 if trouble.
|
||||
|
||||
clang-format -style=file $@ | diff -u $@ -
|
||||
$(dirname "$0")/clang-format.sh -style=file $@ | diff -u $@ -
|
||||
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2018, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
CLANG_FORMAT_VERSION="clang-format version 5.0"
|
||||
|
||||
die() {
|
||||
echo " *** ERROR: " $*
|
||||
exit 1
|
||||
}
|
||||
|
||||
if which clang-format > /dev/null; then
|
||||
case "$(clang-format --version)" in
|
||||
"$CLANG_FORMAT_VERSION"*)
|
||||
;;
|
||||
*)
|
||||
die "clang-format 5.0 required"
|
||||
;;
|
||||
esac
|
||||
elif which clang-format-5.0 > /dev/null; then
|
||||
alias clang-format=clang-format-5.0
|
||||
else
|
||||
die "clang-format 5.0 required"
|
||||
fi
|
||||
|
||||
clang-format $@
|
||||
Reference in New Issue
Block a user