mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
changing matrices and removing msc < 1910 work arounds
This commit is contained in:
parent
0843ea444f
commit
09caa20d99
12
.travis.yml
12
.travis.yml
@ -17,6 +17,10 @@ stages:
|
|||||||
- name: Legacy # build with all other supported compilers
|
- name: Legacy # build with all other supported compilers
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
fast_finish: true
|
||||||
|
allow_failures:
|
||||||
|
- stage: Legacy
|
||||||
|
|
||||||
include:
|
include:
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@ -111,6 +115,7 @@ jobs:
|
|||||||
|
|
||||||
# Xcode 10.1
|
# Xcode 10.1
|
||||||
- name: AppleClang Xcode-10.1 C++14 Debug
|
- name: AppleClang Xcode-10.1 C++14 Debug
|
||||||
|
stage: Latest
|
||||||
env: BUILD_TYPE=Debug GSL_CXX_STANDARD=14
|
env: BUILD_TYPE=Debug GSL_CXX_STANDARD=14
|
||||||
os: osx
|
os: osx
|
||||||
osx_image: xcode10.1 # AppleClang 10.0.0 same compiler as Xcode 10.0
|
osx_image: xcode10.1 # AppleClang 10.0.0 same compiler as Xcode 10.0
|
||||||
@ -147,7 +152,6 @@ jobs:
|
|||||||
|
|
||||||
# Xcode 11.3
|
# Xcode 11.3
|
||||||
- name: AppleClang Xcode-11.3 C++17 Debug
|
- name: AppleClang Xcode-11.3 C++17 Debug
|
||||||
stage: Latest
|
|
||||||
env: BUILD_TYPE=Debug GSL_CXX_STANDARD=17
|
env: BUILD_TYPE=Debug GSL_CXX_STANDARD=17
|
||||||
os: osx
|
os: osx
|
||||||
osx_image: xcode11.3 # AppleClang 11.0.0 linker update / same as Xcode 11.2
|
osx_image: xcode11.3 # AppleClang 11.0.0 linker update / same as Xcode 11.2
|
||||||
@ -296,6 +300,7 @@ jobs:
|
|||||||
|
|
||||||
# Clang 9
|
# Clang 9
|
||||||
- name: Clang-9 C++14 Debug
|
- name: Clang-9 C++14 Debug
|
||||||
|
stage: Latest
|
||||||
env: CXX=clang++-9 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
|
env: CXX=clang++-9 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
|
||||||
addons: &clang9
|
addons: &clang9
|
||||||
apt:
|
apt:
|
||||||
@ -316,7 +321,6 @@ jobs:
|
|||||||
|
|
||||||
# Clang 10
|
# Clang 10
|
||||||
- name: Clang-10 C++14 Debug
|
- name: Clang-10 C++14 Debug
|
||||||
stage: Latest
|
|
||||||
env: CXX=clang++-10 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
|
env: CXX=clang++-10 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
|
||||||
addons: &clang10
|
addons: &clang10
|
||||||
apt:
|
apt:
|
||||||
@ -370,6 +374,7 @@ jobs:
|
|||||||
|
|
||||||
# GCC 8
|
# GCC 8
|
||||||
- name: GCC-8 C++14 Debug
|
- name: GCC-8 C++14 Debug
|
||||||
|
stage: Latest
|
||||||
env: CXX=g++-8 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
|
env: CXX=g++-8 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
|
||||||
addons: &gcc8
|
addons: &gcc8
|
||||||
apt:
|
apt:
|
||||||
@ -386,7 +391,6 @@ jobs:
|
|||||||
|
|
||||||
# GCC 9
|
# GCC 9
|
||||||
- name: GCC-9 C++14 Debug
|
- name: GCC-9 C++14 Debug
|
||||||
stage: Latest
|
|
||||||
env: CXX=g++-9 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
|
env: CXX=g++-9 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
|
||||||
addons: &gcc9
|
addons: &gcc9
|
||||||
apt:
|
apt:
|
||||||
@ -538,7 +542,7 @@ before_script:
|
|||||||
- |
|
- |
|
||||||
cd "${TRAVIS_BUILD_DIR:?}"
|
cd "${TRAVIS_BUILD_DIR:?}"
|
||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
if [[ ${GSL_CXX_STANDARD:-} ]]; then
|
if [[ ${GSL_CXX_STANDARD:-} ]]; then
|
||||||
CMAKE_GEN_FLAGS=("-DGSL_CXX_STANDARD=$GSL_CXX_STANDARD")
|
CMAKE_GEN_FLAGS=("-DGSL_CXX_STANDARD=$GSL_CXX_STANDARD")
|
||||||
fi
|
fi
|
||||||
CMAKE_GEN_FLAGS+=("-Wdev -Werror=dev --warn-uninitialized")
|
CMAKE_GEN_FLAGS+=("-Wdev -Werror=dev --warn-uninitialized")
|
||||||
|
16
README.md
16
README.md
@ -22,10 +22,18 @@ This project makes use of the [Google Test](https://github.com/google/googletest
|
|||||||
|
|
||||||
# Quick Start
|
# Quick Start
|
||||||
## Supported Platforms
|
## Supported Platforms
|
||||||
The test suite that exercises GSL has been built and passes successfully on the following platforms:<sup>1)</sup>
|
The GSL officially supports the current and previous major releases of MSVC, GCC, Clang, and XCode's AppleClang.
|
||||||
|
See our latest test results for the most up-to-date list of supported configurations. <sup>1)</sup>
|
||||||
|
|
||||||
|
- For XCode, Clang, and GCC: [![Build Status](https://travis-ci.org/Microsoft/GSL.svg?branch=master)](https://travis-ci.org/Microsoft/GSL)
|
||||||
|
- For Visual Studio with MSVC and LLVM toolsets: [![Build status](https://ci.appveyor.com/api/projects/status/github/Microsoft/GSL?svg=true)](https://ci.appveyor.com/project/neilmacintosh/GSL)
|
||||||
|
- Android and iOS support: ![CI](https://github.com/microsoft/GSL/workflows/CI/badge.svg) <sup>2)</sup>
|
||||||
|
|
||||||
|
|
||||||
|
The test suite that exercises GSL has been built and passes successfully on the following platforms: <sup>3)</sup>
|
||||||
|
|
||||||
* Windows using Visual Studio 2015
|
|
||||||
* Windows using Visual Studio 2017
|
* Windows using Visual Studio 2017
|
||||||
|
* Windows using Visual Studio 2019
|
||||||
* Windows using Clang/LLVM 3.6
|
* Windows using Clang/LLVM 3.6
|
||||||
* Windows using Clang/LLVM 7.0.0
|
* Windows using Clang/LLVM 7.0.0
|
||||||
* Windows using GCC 5.1
|
* Windows using GCC 5.1
|
||||||
@ -50,7 +58,9 @@ The test suite that exercises GSL has been built and passes successfully on the
|
|||||||
> If you successfully port GSL to another platform, we would love to hear from you. Please submit an issue to let us know. Also please consider
|
> If you successfully port GSL to another platform, we would love to hear from you. Please submit an issue to let us know. Also please consider
|
||||||
contributing any changes that were necessary back to this project to benefit the wider community.
|
contributing any changes that were necessary back to this project to benefit the wider community.
|
||||||
|
|
||||||
<sup>1)</sup> For `gsl::byte` to work correctly with Clang and GCC you might have to use the ` -fno-strict-aliasing` compiler option.
|
<sup>1)</sup> The test matrix contains legacy versions of these compilers. The legacy releases are no longer officially supported. If a change causes a legacy compiler to fail, please file an issue or submit a pull request to have the legacy version to be removed from the test matrix.
|
||||||
|
<sup>2)</sup> Android and iOS build failures are non-blocking and do not prevent pull request merging.
|
||||||
|
<sup>3)</sup> For `gsl::byte` to work correctly with Clang and GCC you might have to use the ` -fno-strict-aliasing` compiler option.
|
||||||
|
|
||||||
## Building the tests
|
## Building the tests
|
||||||
To build the tests, you will require the following:
|
To build the tests, you will require the following:
|
||||||
|
24
appveyor.yml
24
appveyor.yml
@ -9,7 +9,6 @@ configuration:
|
|||||||
- Release
|
- Release
|
||||||
|
|
||||||
image:
|
image:
|
||||||
- Visual Studio 2015
|
|
||||||
- Visual Studio 2017
|
- Visual Studio 2017
|
||||||
- Visual Studio 2019
|
- Visual Studio 2019
|
||||||
|
|
||||||
@ -17,7 +16,6 @@ environment:
|
|||||||
NINJA_TAG: v1.8.2
|
NINJA_TAG: v1.8.2
|
||||||
NINJA_SHA512: 9B9CE248240665FCD6404B989F3B3C27ED9682838225E6DC9B67B551774F251E4FF8A207504F941E7C811E7A8BE1945E7BCB94472A335EF15E23A0200A32E6D5
|
NINJA_SHA512: 9B9CE248240665FCD6404B989F3B3C27ED9682838225E6DC9B67B551774F251E4FF8A207504F941E7C811E7A8BE1945E7BCB94472A335EF15E23A0200A32E6D5
|
||||||
NINJA_PATH: C:\Tools\ninja\ninja-%NINJA_TAG%
|
NINJA_PATH: C:\Tools\ninja\ninja-%NINJA_TAG%
|
||||||
VCVAR2015: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat'
|
|
||||||
VCVAR2017: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat'
|
VCVAR2017: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat'
|
||||||
VCVAR2019: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat'
|
VCVAR2019: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat'
|
||||||
matrix:
|
matrix:
|
||||||
@ -34,14 +32,6 @@ environment:
|
|||||||
USE_TOOLSET: LLVM
|
USE_TOOLSET: LLVM
|
||||||
USE_GENERATOR: Ninja
|
USE_GENERATOR: Ninja
|
||||||
|
|
||||||
matrix:
|
|
||||||
exclude:
|
|
||||||
- image: Visual Studio 2015
|
|
||||||
GSL_CXX_STANDARD: 17
|
|
||||||
- image: Visual Studio 2015
|
|
||||||
USE_TOOLSET: LLVM
|
|
||||||
USE_GENERATOR: MSBuild
|
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
- C:\cmake-3.14.4-win32-x86
|
- C:\cmake-3.14.4-win32-x86
|
||||||
- C:\Tools\ninja
|
- C:\Tools\ninja
|
||||||
@ -72,9 +62,7 @@ before_build:
|
|||||||
if ("$env:USE_GENERATOR" -eq "Ninja") {
|
if ("$env:USE_GENERATOR" -eq "Ninja") {
|
||||||
$GeneratorFlags = '-k 10'
|
$GeneratorFlags = '-k 10'
|
||||||
$Architecture = $env:PLATFORM
|
$Architecture = $env:PLATFORM
|
||||||
if ("$env:APPVEYOR_BUILD_WORKER_IMAGE" -eq "Visual Studio 2015") {
|
if ("$env:APPVEYOR_BUILD_WORKER_IMAGE" -eq "Visual Studio 2017") {
|
||||||
$env:VCVARSALL = "`"$env:VCVAR2015`" $Architecture"
|
|
||||||
} elseif ("$env:APPVEYOR_BUILD_WORKER_IMAGE" -eq "Visual Studio 2017") {
|
|
||||||
$env:VCVARSALL = "`"$env:VCVAR2017`" $Architecture"
|
$env:VCVARSALL = "`"$env:VCVAR2017`" $Architecture"
|
||||||
} else {
|
} else {
|
||||||
$env:VCVARSALL = "`"$env:VCVAR2019`" $Architecture"
|
$env:VCVARSALL = "`"$env:VCVAR2019`" $Architecture"
|
||||||
@ -82,17 +70,15 @@ before_build:
|
|||||||
$env:CMakeGenFlags = "-G Ninja -DGSL_CXX_STANDARD=$env:GSL_CXX_STANDARD"
|
$env:CMakeGenFlags = "-G Ninja -DGSL_CXX_STANDARD=$env:GSL_CXX_STANDARD"
|
||||||
} else {
|
} else {
|
||||||
$GeneratorFlags = '/m /v:minimal'
|
$GeneratorFlags = '/m /v:minimal'
|
||||||
if ("$env:APPVEYOR_BUILD_WORKER_IMAGE" -eq "Visual Studio 2015") {
|
if ("$env:APPVEYOR_BUILD_WORKER_IMAGE" -eq "Visual Studio 2017") {
|
||||||
$Generator = 'Visual Studio 14 2015'
|
|
||||||
} elseif ("$env:APPVEYOR_BUILD_WORKER_IMAGE" -eq "Visual Studio 2017") {
|
|
||||||
$Generator = 'Visual Studio 15 2017'
|
$Generator = 'Visual Studio 15 2017'
|
||||||
} else {
|
} else {
|
||||||
$Generator = 'Visual Studio 16 2019'
|
$Generator = 'Visual Studio 16 2019'
|
||||||
}
|
}
|
||||||
if ("$env:PLATFORM" -eq "x86") {
|
if ("$env:PLATFORM" -eq "x86") {
|
||||||
$Architecture = "Win32"
|
$Architecture = "Win32"
|
||||||
} else {
|
} else {
|
||||||
$Architecture = "x64"
|
$Architecture = "x64"
|
||||||
}
|
}
|
||||||
if ("$env:USE_TOOLSET" -eq "LLVM") {
|
if ("$env:USE_TOOLSET" -eq "LLVM") {
|
||||||
$env:CMakeGenFlags = "-G `"$Generator`" -A $Architecture -T llvm -DGSL_CXX_STANDARD=$env:GSL_CXX_STANDARD"
|
$env:CMakeGenFlags = "-G `"$Generator`" -A $Architecture -T llvm -DGSL_CXX_STANDARD=$env:GSL_CXX_STANDARD"
|
||||||
|
@ -30,18 +30,8 @@
|
|||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4127) // conditional expression is constant
|
#pragma warning(disable : 4127) // conditional expression is constant
|
||||||
|
|
||||||
#if _MSC_VER < 1910
|
|
||||||
#pragma push_macro("constexpr")
|
|
||||||
#define constexpr /*constexpr*/
|
|
||||||
#endif // _MSC_VER < 1910
|
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
#if (defined(_MSC_VER) && _MSC_VER < 1910) || (!defined(__clang__) && defined(__GNUC__) && __GNUC__ < 6)
|
|
||||||
#define GSL_CONSTEXPR_NARROW 0
|
|
||||||
#else
|
|
||||||
#define GSL_CONSTEXPR_NARROW 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace gsl
|
namespace gsl
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@ -113,9 +103,7 @@ namespace details
|
|||||||
template <class T, class U>
|
template <class T, class U>
|
||||||
GSL_SUPPRESS(type.1) // NO-FORMAT: attribute
|
GSL_SUPPRESS(type.1) // NO-FORMAT: attribute
|
||||||
GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false)
|
GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false)
|
||||||
#if GSL_CONSTEXPR_NARROW
|
|
||||||
constexpr
|
constexpr
|
||||||
#endif
|
|
||||||
T narrow(U u) noexcept(false)
|
T narrow(U u) noexcept(false)
|
||||||
{
|
{
|
||||||
T t = narrow_cast<T>(u);
|
T t = narrow_cast<T>(u);
|
||||||
@ -158,11 +146,6 @@ constexpr T at(const std::initializer_list<T> cont, const index i)
|
|||||||
} // namespace gsl
|
} // namespace gsl
|
||||||
|
|
||||||
#if defined(_MSC_VER) && !defined(__clang__)
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
#if _MSC_VER < 1910
|
|
||||||
#undef constexpr
|
|
||||||
#pragma pop_macro("constexpr")
|
|
||||||
|
|
||||||
#endif // _MSC_VER < 1910
|
|
||||||
|
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
|
||||||
|
@ -38,12 +38,6 @@
|
|||||||
#pragma warning(disable : 26495) // uninitalized member when constructor calls constructor
|
#pragma warning(disable : 26495) // uninitalized member when constructor calls constructor
|
||||||
#pragma warning(disable : 26446) // parser bug does not allow attributes on some templates
|
#pragma warning(disable : 26446) // parser bug does not allow attributes on some templates
|
||||||
|
|
||||||
#if _MSC_VER < 1910
|
|
||||||
#pragma push_macro("constexpr")
|
|
||||||
#define constexpr /*constexpr*/
|
|
||||||
#define GSL_USE_STATIC_CONSTEXPR_WORKAROUND
|
|
||||||
|
|
||||||
#endif // _MSC_VER < 1910
|
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
// See if we have enough C++17 power to use a static constexpr data member
|
// See if we have enough C++17 power to use a static constexpr data member
|
||||||
@ -748,11 +742,6 @@ as_writable_bytes(span<ElementType, Extent> s) noexcept
|
|||||||
} // namespace gsl
|
} // namespace gsl
|
||||||
|
|
||||||
#if defined(_MSC_VER) && !defined(__clang__)
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
#if _MSC_VER < 1910
|
|
||||||
#undef constexpr
|
|
||||||
#pragma pop_macro("constexpr")
|
|
||||||
|
|
||||||
#endif // _MSC_VER < 1910
|
|
||||||
|
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
@ -36,11 +36,6 @@
|
|||||||
#pragma warning(disable : 26446) // TODO: bug in parser - attributes and templates
|
#pragma warning(disable : 26446) // TODO: bug in parser - attributes and templates
|
||||||
#pragma warning(disable : 26481) // TODO: suppress does not work inside templates sometimes
|
#pragma warning(disable : 26481) // TODO: suppress does not work inside templates sometimes
|
||||||
|
|
||||||
#if _MSC_VER < 1910
|
|
||||||
#pragma push_macro("constexpr")
|
|
||||||
#define constexpr /*constexpr*/
|
|
||||||
|
|
||||||
#endif // _MSC_VER < 1910
|
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
namespace gsl
|
namespace gsl
|
||||||
@ -706,11 +701,6 @@ bool operator>=(const T& one, gsl::basic_string_span<CharT, Extent> other)
|
|||||||
#if defined(_MSC_VER) && !defined(__clang__)
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
|
||||||
#if _MSC_VER < 1910
|
|
||||||
#undef constexpr
|
|
||||||
#pragma pop_macro("constexpr")
|
|
||||||
|
|
||||||
#endif // _MSC_VER < 1910
|
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
#endif // GSL_STRING_SPAN_H
|
#endif // GSL_STRING_SPAN_H
|
||||||
|
Loading…
Reference in New Issue
Block a user