Permalink
Browse files

Use more modern clang-format (#366)

Don't use clang-format-3.9 for automatic checking as most people don't have it any longer
  • Loading branch information...
malb committed Dec 21, 2018
1 parent 28307a0 commit e0c79ee3d69204a069d347ea466d566b2366c578
Showing with 16 additions and 10 deletions.
  1. +6 −0 .travis-check-style.sh
  2. +9 −9 .travis.yml
  3. +1 −1 CONTRIBUTING.md
@@ -5,6 +5,12 @@ if [ "$CI" = "true" ] && [ "$TRAVIS_OS_NAME" = "osx" ]; then
exit 0;
fi

if [ "$CI" = "true" ] && [ "$CLANGFORMAT" = "clang-format-3.9" ]; then
echo "Skipping style check when using clang-format-3.9.";
exit 0;
fi


make check-style
if [[ $(git status -s) ]];
then
@@ -23,7 +23,7 @@ matrix:
- sudo apt-get install -qq -y clang-format-3.9
- os: linux
compiler: gcc
env: COMPILER=g++-4.9 CLANGFORMAT=clang-format-3.9
env: COMPILER=g++-4.9 CLANGFORMAT=clang-format-6.0
addons:
apt:
sources:
@@ -34,13 +34,13 @@ matrix:
- libmpfr-dev
- libqd-dev
before_install:
- sudo add-apt-repository 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main'
- sudo add-apt-repository 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main'
- wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo apt-get update -qq
- sudo apt-get install -qq -y clang-format-3.9
- sudo apt-get install -qq -y clang-format-6.0
- os: linux
compiler: gcc
env: COMPILER=g++-5 CLANGFORMAT=clang-format-3.9
env: COMPILER=g++-5 CLANGFORMAT=clang-format-6.0
addons:
apt:
sources:
@@ -51,13 +51,13 @@ matrix:
- libmpfr-dev
- libqd-dev
before_install:
- sudo add-apt-repository 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main'
- sudo add-apt-repository 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main'
- wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo apt-get update -qq
- sudo apt-get install -qq -y clang-format-3.9
- sudo apt-get install -qq -y clang-format-6.0
- os: linux
compiler: gcc
env: COMPILER=g++-6 CLANGFORMAT=clang-format-3.9 CXXFLAGS="-O3 -ggdb -fprofile-arcs -ftest-coverage"
env: COMPILER=g++-6 CLANGFORMAT=clang-format-6.0 CXXFLAGS="-O3 -ggdb -fprofile-arcs -ftest-coverage"
addons:
apt:
sources:
@@ -68,10 +68,10 @@ matrix:
- libmpfr-dev
- libqd-dev
before_install:
- sudo add-apt-repository 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main'
- sudo add-apt-repository 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main'
- wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo apt-get update -qq
- sudo apt-get install -qq -y clang-format-3.9
- sudo apt-get install -qq -y clang-format-6.0
script:
- make
- make check
@@ -208,7 +208,7 @@ make check-style

and require clang-format to be installed.

In order to improve readability, some situations might require manual formatting. Clang-format [includes a comment trigger](http://llvm.org/releases/3.9.0/tools/clang/docs/ClangFormatStyleOptions.html#disabling-formatting-on-a-piece-of-code) to _locally_ disable the formatting. The code between a comment `// clang-format off` or `/* clang-format off */` up to a comment `// clang-format on` or `/* clang-format on */` will not be formatted.
In order to improve readability, some situations might require manual formatting. Clang-format [includes a comment trigger](http://llvm.org/releases/6.0.0/tools/clang/docs/https://releases.llvm.org/6.0.0/tools/clang/docs/ClangFormatStyleOptions.html#disabling-formatting-on-a-piece-of-code) to _locally_ disable the formatting. The code between a comment `// clang-format off` or `/* clang-format off */` up to a comment `// clang-format on` or `/* clang-format on */` will not be formatted.

```
int formatted_code;

0 comments on commit e0c79ee

Please sign in to comment.