language: cpp

before_install:
  - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
  - sudo add-apt-repository -y 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main'
  - sudo add-apt-repository -y 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.5 main'
  - sudo add-apt-repository -y 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.6 main'
  - sudo apt-get update -qq
install:
  - sudo apt-get install -qq --force-yes valgrind ${COMPILER}

script: CXX=${COMPILER} ./postsubmit.sh

branches:
  only:
    - master

matrix:
  include:
    - compiler: gcc
      env: COMPILER=g++-4.8
    - compiler: gcc
      env: COMPILER=g++-4.9
    - compiler: gcc
      env: COMPILER=g++-5
    - compiler: clang
      env: COMPILER=clang++-3.4
    - compiler: clang
      env: COMPILER=clang++-3.5
    - compiler: clang
      env: COMPILER=clang++-3.6

language: cpp

before_install:
  - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
  - sudo add-apt-repository -y 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main'
  - sudo add-apt-repository -y 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.5 main'
  - sudo add-apt-repository -y 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.6 main'
  - sudo apt-get update -qq
install:
  # Always install latest GCC 4.8 to avoid bugs in old STL when compiling with Clang.
  - sudo apt-get install -qq --force-yes g++-4.8
  - sudo apt-get install -qq --force-yes valgrind ${COMPILER_TO_INSTALL}

script: CXX=${COMPILER_TO_RUN} ./postsubmit.sh

branches:
  only:
    - master

matrix:
  include:
    - compiler: gcc
      env: COMPILER_TO_INSTALL=g++-4.8     COMPILER_TO_RUN=g++-4.8
    - compiler: gcc
      env: COMPILER_TO_INSTALL=g++-4.9     COMPILER_TO_RUN=g++-4.9
    - compiler: gcc
      env: COMPILER_TO_INSTALL=g++-5       COMPILER_TO_RUN=g++-5
    - compiler: clang
      env: COMPILER_TO_INSTALL=clang++-3.4 COMPILER_TO_RUN=clang++
    - compiler: clang
      env: COMPILER_TO_INSTALL=clang++-3.5 COMPILER_TO_RUN=clang++-3.5
    - compiler: clang
      env: COMPILER_TO_INSTALL=clang++-3.6 COMPILER_TO_RUN=clang++-3.6
    - compiler: clang
      env: COMPILER_TO_INSTALL=clang++-3.7 COMPILER_TO_RUN=clang++-3.7

Split COMPILER_TO_INSTALL and COMPILER_TO_RUN in the Travis CI config, as clang 3.4 does not have a clang++-3.4 symlink (while other versions do). Also add Clang 3.7.
Split COMPILER_TO_INSTALL and COMPILER_TO_RUN in the Travis CI config, as clang 3.4 does not have a clang++-3.4 symlink (while other versions do). Also add Clang 3.7.
