Skip to content

Commit 765709f

Browse files
committed
Squashed 'gsl/' changes from 7d78b74..7e99e76
7e99e76 Merge pull request #826 from JordanMaples/dev/jomaples/ctad_fix_v2 263440f changing white-space in comment to get tests to rerun a7759e6 lower __cpp_deduction_guide version number from 201907 to 201611 128b435 changing check from __cplusplus 201703L to __cpp_deduction_guides 201907L 8e481eb adding deduction guide for strict_not_null 4610f26 forgot comment d0e5daf fix ctad warning in llvm 9939d58 Merge pull request #822 from JordanMaples/dev/jomaples/lib-byte-check 22cba52 update comments 97dc8f8 adding check to __cpp_lib_byte, which was added to the defn for 15.8 71ec9f8 Merge pull request #2 from microsoft/master 3d56ba9 Merge pull request #813 from JordanMaples/dev/jomaples/deprecate_multispan cf9cc34 Merge pull request #815 from matt77hias/patch-1 0a78d8e Added std::exchange (C++14) to make the intent more explicit 02d1051 Merge pull request #814 from sizmailov/fix_typos 275e017 Fix typos in gsl/pointers 4b289d4 lack of nl for bounds_test 6ff4a52 accidentally commented out pragma 2b8f7ae adding clang/gcc suppression of the deprecation warnings. 7adf7eb new messages 5e4463a removing function deprecation, adding additional class / struct deprecations 10ce5b6 Merge pull request #812 from JordanMaples/dev/jomaples/typo_fixes eb995b3 deprecating strided_span b630dfe Guideline -> Guidelines e026971 deprecation, removing cassert bbeb0bd initial deprecation of multi_span and strided_span 23066c8 Update README.md a454d29 Merge pull request #803 from B1Z0N/master ba9af38 Merge branch 'master' of https://github.com/B1Z0N/GSL d5382a2 Fixed memory leaks 787e7ef Thanks to @stayprivates fixed out of bounds access in "TestNotNullostream" 1046c9d Merge pull request #1 from microsoft/master b576cc6 Merge pull request #769 from jack17529/patch-1 2ce3177 Merge pull request #800 from eyalroz/master cee1929 Fix GNUC typo (#780) 1d48188 Fixed check if std::byte is available (#764) b05a446 Fixes #798 : Dropped inclusion of `gsl/pointers` in `string_span`. 1212bea Add Visual Studio 2019 image for tests (#787) 66809c6 make TypeListIndexer constexpr (#733) b74b286 add value_type size_type for string_span (#727) 2a1ef25 Update span git-subtree-dir: gsl git-subtree-split: 7e99e76c9761d0d0b0848b91f8648830670ee872
1 parent 5158d34 commit 765709f

16 files changed

+207
-176
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
## Contributing to the Guideline Support Library
1+
## Contributing to the Guidelines Support Library
22

3-
The Guideline Support Library (GSL) contains functions and types that are suggested for use by the
3+
The Guidelines Support Library (GSL) contains functions and types that are suggested for use by the
44
[C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines). GSL design changes are made only as a result of modifications to the Guidelines.
55

66
GSL is accepting contributions that improve or refine any of the types in this library as well as ports to other platforms. Changes should have an issue

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ The test suite that exercises GSL has been built and passes successfully on the
3636
* GNU/Linux using Clang/LLVM 6.0
3737
* GNU/Linux using Clang/LLVM 7.0
3838
* GNU/Linux using GCC 5.1
39+
* OS X Mojave 10.14.4 using Apple LLVM version 10.0.0 (10.0.1.10010046)
40+
* OS X Mojave 10.14.3 using Apple LLVM version 10.0.0 (clang-1000.11.45.5)
3941
* OS X Yosemite using Xcode with Apple Clang 7.0.0.7000072
4042
* OS X Yosemite using GCC-5.2.0
4143
* OS X Sierra 10.12.4 using Apple LLVM version 8.1.0 (Clang-802.0.42)

ThirdPartyNotices.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
33
Do Not Translate or Localize
44

5-
GSL: Guideline Support Library incorporates third party material from the projects listed below. The original copyright notice and the license under which Microsoft received such third party material are set forth below. Microsoft reserves all other rights not expressly granted, whether by implication, estoppel or otherwise.
5+
GSL: Guidelines Support Library incorporates third party material from the projects listed below. The original copyright notice and the license under which Microsoft received such third party material are set forth below. Microsoft reserves all other rights not expressly granted, whether by implication, estoppel or otherwise.
66

77

88
1. Catch (https://github.com/philsquared/Catch)

appveyor.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ configuration:
1111
image:
1212
- Visual Studio 2015
1313
- Visual Studio 2017
14+
- Visual Studio 2019
1415

1516
environment:
1617
NINJA_TAG: v1.8.2
1718
NINJA_SHA512: 9B9CE248240665FCD6404B989F3B3C27ED9682838225E6DC9B67B551774F251E4FF8A207504F941E7C811E7A8BE1945E7BCB94472A335EF15E23A0200A32E6D5
1819
NINJA_PATH: C:\Tools\ninja\ninja-%NINJA_TAG%
1920
VCVAR2015: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat'
2021
VCVAR2017: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat'
22+
VCVAR2019: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat'
2123
matrix:
2224
- GSL_CXX_STANDARD: 14
2325
USE_TOOLSET: MSVC
@@ -41,7 +43,7 @@ matrix:
4143
USE_GENERATOR: MSBuild
4244

4345
cache:
44-
- C:\cmake-3.8.0-win32-x86
46+
- C:\cmake-3.14.4-win32-x86
4547
- C:\Tools\ninja
4648

4749
install:
@@ -58,11 +60,11 @@ install:
5860
$env:PATH = "$env:NINJA_PATH;$env:PATH"
5961
} else { Write-Warning "Failed to find ninja.exe in expected location." }
6062
if ($env:USE_TOOLSET -ne "LLVM") {
61-
if (![IO.File]::Exists("C:\cmake-3.8.0-win32-x86\bin\cmake.exe")) {
62-
Start-FileDownload 'https://cmake.org/files/v3.8/cmake-3.8.0-win32-x86.zip'
63-
7z x -y -bso0 cmake-3.8.0-win32-x86.zip -oC:\
63+
if (![IO.File]::Exists("C:\cmake-3.14.0-win32-x86\bin\cmake.exe")) {
64+
Start-FileDownload 'https://cmake.org/files/v3.14/cmake-3.14.4-win32-x86.zip'
65+
7z x -y -bso0 cmake-3.14.4-win32-x86.zip -oC:\
6466
}
65-
$env:PATH="C:\cmake-3.8.0-win32-x86\bin;$env:PATH"
67+
$env:PATH="C:\cmake-3.14.4-win32-x86\bin;$env:PATH"
6668
}
6769
6870
before_build:
@@ -72,16 +74,20 @@ before_build:
7274
$Architecture = $env:PLATFORM
7375
if ("$env:APPVEYOR_BUILD_WORKER_IMAGE" -eq "Visual Studio 2015") {
7476
$env:VCVARSALL = "`"$env:VCVAR2015`" $Architecture"
75-
} else {
77+
} elseif ("$env:APPVEYOR_BUILD_WORKER_IMAGE" -eq "Visual Studio 2017") {
7678
$env:VCVARSALL = "`"$env:VCVAR2017`" $Architecture"
79+
} else {
80+
$env:VCVARSALL = "`"$env:VCVAR2019`" $Architecture"
7781
}
7882
$env:CMakeGenFlags = "-G Ninja -DGSL_CXX_STANDARD=$env:GSL_CXX_STANDARD"
7983
} else {
8084
$GeneratorFlags = '/m /v:minimal'
8185
if ("$env:APPVEYOR_BUILD_WORKER_IMAGE" -eq "Visual Studio 2015") {
8286
$Generator = 'Visual Studio 14 2015'
83-
} else {
87+
} elseif ("$env:APPVEYOR_BUILD_WORKER_IMAGE" -eq "Visual Studio 2017") {
8488
$Generator = 'Visual Studio 15 2017'
89+
} else {
90+
$Generator = 'Visual Studio 16 2019'
8591
}
8692
if ("$env:PLATFORM" -eq "x86") {
8793
$Architecture = "Win32"

include/gsl/gsl_byte

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
#include <type_traits>
3535

36+
// VS2017 15.8 added support for the __cpp_lib_byte definition
37+
// To do: drop _HAS_STD_BYTE when support for pre 15.8 expires
3638
#ifdef _MSC_VER
3739

3840
#pragma warning(push)
@@ -42,28 +44,28 @@
4244

4345
#ifndef GSL_USE_STD_BYTE
4446
// this tests if we are under MSVC and the standard lib has std::byte and it is enabled
45-
#if defined(_HAS_STD_BYTE) && _HAS_STD_BYTE
47+
#if (defined(_HAS_STD_BYTE) && _HAS_STD_BYTE) || (defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603)
4648

4749
#define GSL_USE_STD_BYTE 1
4850

49-
#else // defined(_HAS_STD_BYTE) && _HAS_STD_BYTE
51+
#else // (defined(_HAS_STD_BYTE) && _HAS_STD_BYTE) || (defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603)
5052

5153
#define GSL_USE_STD_BYTE 0
5254

53-
#endif // defined(_HAS_STD_BYTE) && _HAS_STD_BYTE
55+
#endif // (defined(_HAS_STD_BYTE) && _HAS_STD_BYTE) || (defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603)
5456
#endif // GSL_USE_STD_BYTE
5557

5658
#else // _MSC_VER
5759

5860
#ifndef GSL_USE_STD_BYTE
61+
#include <cstddef> /* __cpp_lib_byte */
5962
// this tests if we are under GCC or Clang with enough -std:c++1z power to get us std::byte
6063
// also check if libc++ version is sufficient (> 5.0) or libstc++ actually contains std::byte
6164
#if defined(__cplusplus) && (__cplusplus >= 201703L) && \
6265
(defined(__cpp_lib_byte) && (__cpp_lib_byte >= 201603) || \
6366
defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION >= 5000))
6467

6568
#define GSL_USE_STD_BYTE 1
66-
#include <cstddef>
6769

6870
#else // defined(__cplusplus) && (__cplusplus >= 201703L) &&
6971
// (defined(__cpp_lib_byte) && (__cpp_lib_byte >= 201603) ||

include/gsl/gsl_util

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <exception> // for exception
2525
#include <initializer_list> // for initializer_list
2626
#include <type_traits> // for is_signed, integral_constant
27-
#include <utility> // for forward
27+
#include <utility> // for exchange, forward
2828

2929
#if defined(_MSC_VER) && !defined(__clang__)
3030

@@ -37,7 +37,7 @@
3737
#endif // _MSC_VER < 1910
3838
#endif // _MSC_VER
3939

40-
#if (defined(_MSC_VER) && _MSC_VER < 1910) || (!defined(__clang__) && defined(__GNUC__) && __GUNC__ < 6)
40+
#if (defined(_MSC_VER) && _MSC_VER < 1910) || (!defined(__clang__) && defined(__GNUC__) && __GNUC__ < 6)
4141
#define GSL_CONSTEXPR_NARROW 0
4242
#else
4343
#define GSL_CONSTEXPR_NARROW 1
@@ -59,10 +59,7 @@ class final_action
5959
public:
6060
explicit final_action(F f) noexcept : f_(std::move(f)) {}
6161

62-
final_action(final_action&& other) noexcept : f_(std::move(other.f_)), invoke_(other.invoke_)
63-
{
64-
other.invoke_ = false;
65-
}
62+
final_action(final_action&& other) noexcept : f_(std::move(other.f_)), invoke_(std::exchange(other.invoke_, false)) {}
6663

6764
final_action(const final_action&) = delete;
6865
final_action& operator=(const final_action&) = delete;

0 commit comments

Comments
 (0)