mirror of
https://github.com/microsoft/GSL.git
synced 2025-04-02 09:18:33 -04:00
Merge branch 'microsoft:main' into gh-1129
This commit is contained in:
commit
8772a45826
29
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
29
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: 'Status: Open, Type: Bug'
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
```c++
|
||||||
|
#include <gsl>
|
||||||
|
|
||||||
|
// your repro here: ...
|
||||||
|
```
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Spec (please complete the following information):**
|
||||||
|
- OS: [e.g. Windows]
|
||||||
|
- Compiler: [e.g. MSVC]
|
||||||
|
- C++ Version: [e.g. C++20]
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
2
.github/workflows/android.yml
vendored
2
.github/workflows/android.yml
vendored
@ -38,7 +38,7 @@ jobs:
|
|||||||
echo "Emulator starting in background"
|
echo "Emulator starting in background"
|
||||||
|
|
||||||
- name: Configure
|
- name: Configure
|
||||||
run: cmake -Werror=dev -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=16 -DANDROID_ABI=x86_64 -DCMAKE_BUILD_TYPE=Debug ..
|
run: cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=16 -DANDROID_ABI=x86_64 -DCMAKE_BUILD_TYPE=Debug ..
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cmake --build . --parallel
|
run: cmake --build . --parallel
|
||||||
|
9
.github/workflows/compilers.yml
vendored
9
.github/workflows/compilers.yml
vendored
@ -23,6 +23,13 @@ jobs:
|
|||||||
exclude:
|
exclude:
|
||||||
- gcc_version: 10
|
- gcc_version: 10
|
||||||
cxx_version: 23
|
cxx_version: 23
|
||||||
|
# https://github.com/google/googletest/issues/4232
|
||||||
|
# Looks like GoogleTest is not interested in making version 1.14
|
||||||
|
# work with gcc-12.
|
||||||
|
- gcc_version: 12
|
||||||
|
cxx_version: 20
|
||||||
|
- gcc_version: 12
|
||||||
|
cxx_version: 23
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@ -54,7 +61,7 @@ jobs:
|
|||||||
xcode:
|
xcode:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
xcode_version: [ '14.3.1', '15.4' ]
|
xcode_version: [ '15.4' ]
|
||||||
build_type: [ Debug, Release ]
|
build_type: [ Debug, Release ]
|
||||||
cxx_version: [ 14, 17, 20, 23 ]
|
cxx_version: [ 14, 17, 20, 23 ]
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.14...3.16)
|
cmake_minimum_required(VERSION 3.14...3.16)
|
||||||
|
|
||||||
project(GSL VERSION 4.0.0 LANGUAGES CXX)
|
project(GSL VERSION 4.1.0 LANGUAGES CXX)
|
||||||
|
|
||||||
add_library(GSL INTERFACE)
|
add_library(GSL INTERFACE)
|
||||||
add_library(Microsoft.GSL::GSL ALIAS GSL)
|
add_library(Microsoft.GSL::GSL ALIAS GSL)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# GSL: Guidelines Support Library
|
# GSL: Guidelines Support Library
|
||||||
[](https://dev.azure.com/cppstat/GSL/_build/latest?definitionId=1&branchName=main)
|
[](https://github.com/microsoft/GSL/actions/workflows/compilers.yml?query=branch%3Amain)
|
||||||
|
[](https://vcpkg.io/en/package/ms-gsl)
|
||||||
|
|
||||||
The Guidelines Support Library (GSL) contains functions and types that are suggested for use by the
|
The Guidelines Support Library (GSL) contains functions and types that are suggested for use by the
|
||||||
[C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines) maintained by the [Standard C++ Foundation](https://isocpp.org).
|
[C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines) maintained by the [Standard C++ Foundation](https://isocpp.org).
|
||||||
@ -106,8 +107,8 @@ If you successfully port GSL to another platform, we would love to hear from you
|
|||||||
|
|
||||||
Target | CI/CD Status
|
Target | CI/CD Status
|
||||||
:------- | -----------:
|
:------- | -----------:
|
||||||
iOS | 
|
iOS | [](https://github.com/microsoft/GSL/actions/workflows/ios.yml?query=branch%3Amain)
|
||||||
Android | 
|
Android | [](https://github.com/microsoft/GSL/actions/workflows/android.yml?query=branch%3Amain)
|
||||||
|
|
||||||
Note: These CI/CD steps are run with each pull request, however failures in them are non-blocking.
|
Note: These CI/CD steps are run with each pull request, however failures in them are non-blocking.
|
||||||
|
|
||||||
@ -197,7 +198,7 @@ include(FetchContent)
|
|||||||
|
|
||||||
FetchContent_Declare(GSL
|
FetchContent_Declare(GSL
|
||||||
GIT_REPOSITORY "https://github.com/microsoft/GSL"
|
GIT_REPOSITORY "https://github.com/microsoft/GSL"
|
||||||
GIT_TAG "v4.0.0"
|
GIT_TAG "v4.1.0"
|
||||||
GIT_SHALLOW ON
|
GIT_SHALLOW ON
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ using std::unique_ptr;
|
|||||||
// T must be a pointer type
|
// T must be a pointer type
|
||||||
// - disallow construction from any type other than pointer type
|
// - disallow construction from any type other than pointer type
|
||||||
//
|
//
|
||||||
template <class T, class = std::enable_if_t<std::is_pointer<T>::value>>
|
template <class T, std::enable_if_t<std::is_pointer<T>::value, bool> = true>
|
||||||
using owner = T;
|
using owner = T;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -117,7 +117,7 @@ public:
|
|||||||
not_null(const not_null& other) = default;
|
not_null(const not_null& other) = default;
|
||||||
not_null& operator=(const not_null& other) = default;
|
not_null& operator=(const not_null& other) = default;
|
||||||
constexpr details::value_or_reference_return_t<T> get() const
|
constexpr details::value_or_reference_return_t<T> get() const
|
||||||
noexcept(noexcept(details::value_or_reference_return_t<T>{std::declval<T&>()}))
|
noexcept(noexcept(details::value_or_reference_return_t<T>(std::declval<T&>())))
|
||||||
{
|
{
|
||||||
return ptr_;
|
return ptr_;
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,9 @@ namespace details
|
|||||||
|
|
||||||
constexpr span_iterator(pointer begin, pointer end, pointer current)
|
constexpr span_iterator(pointer begin, pointer end, pointer current)
|
||||||
: begin_(begin), end_(end), current_(current)
|
: begin_(begin), end_(end), current_(current)
|
||||||
{}
|
{
|
||||||
|
Expects(begin_ <= current_ && current <= end_);
|
||||||
|
}
|
||||||
|
|
||||||
constexpr operator span_iterator<const Type>() const noexcept
|
constexpr operator span_iterator<const Type>() const noexcept
|
||||||
{
|
{
|
||||||
@ -149,21 +151,18 @@ namespace details
|
|||||||
|
|
||||||
constexpr reference operator*() const noexcept
|
constexpr reference operator*() const noexcept
|
||||||
{
|
{
|
||||||
Expects(begin_ && end_);
|
Expects(current_ != end_);
|
||||||
Expects(begin_ <= current_ && current_ < end_);
|
|
||||||
return *current_;
|
return *current_;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr pointer operator->() const noexcept
|
constexpr pointer operator->() const noexcept
|
||||||
{
|
{
|
||||||
Expects(begin_ && end_);
|
Expects(current_ != end_);
|
||||||
Expects(begin_ <= current_ && current_ < end_);
|
|
||||||
return current_;
|
return current_;
|
||||||
}
|
}
|
||||||
constexpr span_iterator& operator++() noexcept
|
constexpr span_iterator& operator++() noexcept
|
||||||
{
|
{
|
||||||
Expects(begin_ && current_ && end_);
|
Expects(current_ != end_);
|
||||||
Expects(current_ < end_);
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute
|
GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute
|
||||||
// clang-format on
|
// clang-format on
|
||||||
@ -180,8 +179,7 @@ namespace details
|
|||||||
|
|
||||||
constexpr span_iterator& operator--() noexcept
|
constexpr span_iterator& operator--() noexcept
|
||||||
{
|
{
|
||||||
Expects(begin_ && end_);
|
Expects(begin_ != current_);
|
||||||
Expects(begin_ < current_);
|
|
||||||
--current_;
|
--current_;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -110,6 +110,7 @@ if(MSVC) # MSVC or simulating MSVC
|
|||||||
-Wno-shift-sign-overflow # GTest gtest-port.h
|
-Wno-shift-sign-overflow # GTest gtest-port.h
|
||||||
-Wno-undef # GTest
|
-Wno-undef # GTest
|
||||||
-Wno-used-but-marked-unused # GTest EXPECT_DEATH
|
-Wno-used-but-marked-unused # GTest EXPECT_DEATH
|
||||||
|
-Wno-switch-default # GTest EXPECT_DEATH
|
||||||
$<$<EQUAL:${GSL_CXX_STANDARD},14>: # no support for [[maybe_unused]]
|
$<$<EQUAL:${GSL_CXX_STANDARD},14>: # no support for [[maybe_unused]]
|
||||||
-Wno-unused-member-function
|
-Wno-unused-member-function
|
||||||
-Wno-unused-variable
|
-Wno-unused-variable
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
cmake_minimum_required(VERSION 3.0.2)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
project(googletest-download NONE)
|
project(googletest-download NONE)
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(googletest
|
ExternalProject_Add(googletest
|
||||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||||
GIT_TAG 1b18723e874b256c1e39378c6774a90701d70f7a
|
GIT_TAG v1.14.0
|
||||||
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
|
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
|
||||||
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
|
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user