mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 02:45:32 +00:00
use c++11 std::align from <memory> (#2026)
* use c++11 std::align from <memory> * for Ubuntu, use gcc5 instead of 4.8 * use travis to set gcc to 5 eval and sudo * use eval in .travis.yml * use gcc-8 * replace precise with trusty llvm toolchain, because we have been using trusty for awhile now * push things to matrix, so we can support multiple releases if we want * we should not be allowing for failures, we are ready to start trusting clang and its analyzer * scan-build was pushed to another package * use gcc-8 still but wrap in scan-build * travis.yml cleanup, have output of scripts go to stdout, make search for substring a regex use double [] fix missing , use bash to use regex black spaces matter * set human readable names for our various builds, split out our static analysis between openmw and openmw-cs * test if not set, then set otherwise ignore * use quotes * do not eval it, set it in travis env * no more && * what does clang7 have to say? * use sourceline for now * use clang-7 instead of clang-7.0 * yes, llvm-toolchain-trusty-7 not llvm-toolchain-trusty-7.0 * for static analysis, openmw is compiled and checked on its own while openmw-cs is build with all the rest. this might change in the future. and actually do it the other way around
This commit is contained in:
parent
3751bc2c11
commit
9ae077c033
5 changed files with 59 additions and 35 deletions
54
.travis.yml
54
.travis.yml
|
@ -1,10 +1,4 @@
|
|||
os:
|
||||
- linux
|
||||
- osx
|
||||
osx_image: xcode9.4
|
||||
language: cpp
|
||||
sudo: required
|
||||
dist: trusty
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
@ -20,16 +14,16 @@ addons:
|
|||
sources:
|
||||
- sourceline: 'ppa:openmw/openmw'
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.6
|
||||
- llvm-toolchain-trusty-7
|
||||
packages: [
|
||||
# Dev
|
||||
cmake, clang-3.6, libunshield-dev, libtinyxml-dev,
|
||||
cmake, clang-7, clang-tools-7, gcc-8, g++-8,
|
||||
# Boost
|
||||
libboost-filesystem-dev, libboost-program-options-dev, libboost-system-dev,
|
||||
# FFmpeg
|
||||
libavcodec-dev, libavformat-dev, libavutil-dev, libswscale-dev,
|
||||
# Audio & Video
|
||||
libsdl2-dev, libqt4-dev, libopenal-dev,
|
||||
# Audio, Video and Misc. deps
|
||||
libsdl2-dev, libqt4-dev, libopenal-dev, libunshield-dev, libtinyxml-dev,
|
||||
# The other ones from OpenMW ppa
|
||||
libbullet-dev, libswresample-dev, libopenscenegraph-3.4-dev, libmygui-dev
|
||||
]
|
||||
|
@ -44,18 +38,44 @@ addons:
|
|||
branch_pattern: coverity_scan
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
- name: OpenMW (all) on MacOS xcode9.4
|
||||
os: osx
|
||||
osx_image: xcode9.4
|
||||
- name: OpenMW (all) on Ubuntu Trusty GCC-8
|
||||
os: linux
|
||||
dist: trusty
|
||||
sudo: required
|
||||
env:
|
||||
ANALYZE="scan-build-3.6 --use-cc clang-3.6 --use-c++ clang++-3.6 "
|
||||
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"
|
||||
- name: OpenMW (openmw) on Ubuntu Trusty Clang-7 with Static Analysis
|
||||
os: linux
|
||||
dist: trusty
|
||||
sudo: required
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-7 && CXX=clang++-7"
|
||||
- ANALYZE="scan-build-7 --use-cc clang-7 --use-c++ clang++-7"
|
||||
- BUILD_OPENMW_CS="OFF"
|
||||
compiler: clang
|
||||
allow_failures:
|
||||
- env: ANALYZE="scan-build-3.6 --use-cc clang-3.6 --use-c++ clang++-3.6 "
|
||||
- name: OpenMW (openmw-cs) on Ubuntu Trusty Clang-7 with Static Analysis
|
||||
os: linux
|
||||
dist: trusty
|
||||
sudo: required
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-7 && CXX=clang++-7"
|
||||
- ANALYZE="scan-build-7 --use-cc clang-7 --use-c++ clang++-7"
|
||||
- BUILD_OPENMW="OFF"
|
||||
compiler: clang
|
||||
# allow_failures:
|
||||
# - name: OpenMW (openmw) on Ubuntu Trusty Clang-7 with Static Analysis
|
||||
|
||||
before_install: ./CI/before_install.${TRAVIS_OS_NAME}.sh
|
||||
before_script: ./CI/before_script.${TRAVIS_OS_NAME}.sh
|
||||
before_install:
|
||||
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then eval "${MATRIX_EVAL}"; fi
|
||||
- ./CI/before_install.${TRAVIS_OS_NAME}.sh
|
||||
before_script:
|
||||
- ./CI/before_script.${TRAVIS_OS_NAME}.sh
|
||||
script:
|
||||
- cd ./build
|
||||
- if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then ${ANALYZE}make -j3; fi
|
||||
- if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then ${ANALYZE} make -j3; fi
|
||||
- if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "osx" ]; then make package; fi
|
||||
- if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then ./openmw_test_suite; fi
|
||||
- if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then cd .. && ./CI/check_tabs.sh; fi
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/bin/sh -e
|
||||
sudo ln -s /usr/bin/clang-3.6 /usr/local/bin/clang
|
||||
sudo ln -s /usr/bin/clang++-3.6 /usr/local/bin/clang++
|
||||
#!/bin/bash -ex
|
||||
|
||||
sudo ln -sf /usr/bin/clang-7 /usr/local/bin/clang
|
||||
sudo ln -sf /usr/bin/clang++-7 /usr/local/bin/clang++
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh -e
|
||||
#!/bin/bash -ex
|
||||
|
||||
free -m
|
||||
|
||||
|
@ -8,8 +8,22 @@ GOOGLETEST_DIR="$(pwd)/googletest/build"
|
|||
mkdir build
|
||||
cd build
|
||||
export CODE_COVERAGE=1
|
||||
if [ "${CC}" = "clang" ]; then export CODE_COVERAGE=0; fi
|
||||
${ANALYZE}cmake \
|
||||
|
||||
if [[ "${CC}" =~ "clang" ]]; then export CODE_COVERAGE=0; fi
|
||||
if [[ -z "${BUILD_OPENMW}" ]]; then export BUILD_OPENMW=ON; fi
|
||||
if [[ -z "${BUILD_OPENMW_CS}" ]]; then export BUILD_OPENMW_CS=ON; fi
|
||||
|
||||
${ANALYZE} cmake \
|
||||
-DBUILD_OPENMW=${BUILD_OPENMW} \
|
||||
-DBUILD_OPENCS=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_LAUNCHER=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_BSATOOL=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_ESMTOOL=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_MWINIIMPORTER=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_ESSIMPORTER=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_WIZARD=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_NIFTEST=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_MYGUI_PLUGIN=${BUILD_OPENMW_CS} \
|
||||
-DBUILD_WITH_CODE_COVERAGE=${CODE_COVERAGE} \
|
||||
-DBUILD_UNITTESTS=1 \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
|
|
|
@ -86,17 +86,6 @@ namespace DetourNavigator
|
|||
return static_cast<std::size_t*>(ptr) + 1;
|
||||
}
|
||||
|
||||
// TODO: use std::align
|
||||
inline void* align(std::size_t align, std::size_t size, void*& ptr, std::size_t& space) noexcept
|
||||
{
|
||||
const auto intptr = reinterpret_cast<std::uintptr_t>(ptr);
|
||||
const auto aligned = (intptr - 1u + align) & - align;
|
||||
const auto diff = aligned - intptr;
|
||||
if ((size + diff) > space)
|
||||
return nullptr;
|
||||
space -= diff;
|
||||
return ptr = reinterpret_cast<void*>(aligned);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace DetourNavigator
|
|||
std::size_t space = mStack.size() - getUsedSize();
|
||||
void* top = mTop;
|
||||
const auto itemSize = 2 * sizeof(std::size_t) + size;
|
||||
if (rcUnlikely(!align(sizeof(std::size_t), itemSize, top, space)))
|
||||
if (rcUnlikely(!std::align(sizeof(std::size_t), itemSize, top, space)))
|
||||
return nullptr;
|
||||
setTempPtrBufferType(top, BufferType_temp);
|
||||
setTempPtrPrev(top, mPrev);
|
||||
|
|
Loading…
Reference in a new issue