mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-28 18:41:57 -05:00
Compare commits
7 Commits
905f8b30bb
...
50ac3c370c
Author | SHA1 | Date | |
---|---|---|---|
|
50ac3c370c | ||
|
32511b8de4 | ||
|
84b2ca1352 | ||
|
ce2a959e02 | ||
|
11fe02d1ac | ||
|
3275f9ccb9 | ||
|
b206bd163b |
23
.github/workflows/android.yml
vendored
23
.github/workflows/android.yml
vendored
@ -1,4 +1,9 @@
|
|||||||
name: CI_Android
|
name: CI_Android
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
@ -7,7 +12,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Android:
|
Android:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest-large
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
working-directory: build
|
working-directory: build
|
||||||
@ -18,15 +23,19 @@ jobs:
|
|||||||
run: mkdir -p build
|
run: mkdir -p build
|
||||||
working-directory: .
|
working-directory: .
|
||||||
|
|
||||||
- name: Start emulator
|
- uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: 8
|
||||||
|
distribution: zulu
|
||||||
|
|
||||||
|
- name: Start Emulator
|
||||||
run: |
|
run: |
|
||||||
echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-24;default;x86_64'
|
echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-24;default;x86_64'
|
||||||
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n xamarin_android_emulator -k 'system-images;android-24;default;x86_64' --force
|
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n xamarin_android_emulator -k 'system-images;android-24;default;x86_64' --force
|
||||||
$ANDROID_HOME/emulator/emulator -list-avds
|
$ANDROID_HOME/emulator/emulator -list-avds
|
||||||
echo "Starting emulator"
|
echo "Starting emulator..."
|
||||||
# Start emulator in background
|
nohup $ANDROID_HOME/emulator/emulator -no-audio -no-snapshot -avd xamarin_android_emulator &> /dev/null &
|
||||||
nohup $ANDROID_HOME/emulator/emulator -avd xamarin_android_emulator -no-snapshot > /dev/null 2>&1 &
|
echo "Emulator starting in background"
|
||||||
echo "Emulator starting"
|
|
||||||
|
|
||||||
- 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 -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 ..
|
||||||
@ -35,11 +44,11 @@ jobs:
|
|||||||
run: cmake --build . --parallel
|
run: cmake --build . --parallel
|
||||||
|
|
||||||
- name: Wait for emulator ready
|
- name: Wait for emulator ready
|
||||||
|
timeout-minutes: 2
|
||||||
run: |
|
run: |
|
||||||
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 10; done; input keyevent 82'
|
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 10; done; input keyevent 82'
|
||||||
$ANDROID_HOME/platform-tools/adb devices
|
$ANDROID_HOME/platform-tools/adb devices
|
||||||
$ANDROID_HOME/platform-tools/adb shell getprop ro.product.cpu.abi
|
$ANDROID_HOME/platform-tools/adb shell getprop ro.product.cpu.abi
|
||||||
echo "Emulator started"
|
|
||||||
|
|
||||||
- name: Deploy tests
|
- name: Deploy tests
|
||||||
run: |
|
run: |
|
||||||
|
56
.github/workflows/cmake/action.yml
vendored
Normal file
56
.github/workflows/cmake/action.yml
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
name: Composite CMake
|
||||||
|
inputs:
|
||||||
|
cmake_generator:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: 'Unix Makefiles'
|
||||||
|
cmake_build_type:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
default: ''
|
||||||
|
cmake_cxx_compiler:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
gsl_cxx_standard:
|
||||||
|
required: true
|
||||||
|
type: number
|
||||||
|
extra_cmake_args:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ''
|
||||||
|
build_cmd:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
default: 'make'
|
||||||
|
test_cmd:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: 'make test'
|
||||||
|
shell:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: 'bash'
|
||||||
|
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Create build directory
|
||||||
|
run: mkdir build
|
||||||
|
shell: ${{ inputs.shell }}
|
||||||
|
|
||||||
|
- name: Configure CMake
|
||||||
|
working-directory: build
|
||||||
|
run: cmake -G "${{ inputs.cmake_generator }}" -DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} -DCMAKE_CXX_COMPILER=${{ inputs.cmake_cxx_compiler }} -DGSL_CXX_STANDARD=${{ inputs.gsl_cxx_standard }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev ${{ inputs.extra_cmake_args }} ..
|
||||||
|
shell: ${{ inputs.shell }}
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
working-directory: build
|
||||||
|
run: ${{ inputs.build_cmd }}
|
||||||
|
shell: ${{ inputs.shell }}
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
working-directory: build
|
||||||
|
run: ${{ inputs.test_cmd }}
|
||||||
|
shell: ${{ inputs.shell }}
|
||||||
|
|
104
.github/workflows/compilers.yml
vendored
Normal file
104
.github/workflows/compilers.yml
vendored
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
name: Compiler Integration Tests
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
# These jobs are correlated with the officially supported compilers
|
||||||
|
# and toolsets. If you change any versions, please update README.md.
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
gcc:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
gcc_version: [ 10, 11, 12 ]
|
||||||
|
build_type: [ Debug, Release ]
|
||||||
|
cxx_version: [ 14, 17, 20, 23 ]
|
||||||
|
exclude:
|
||||||
|
- gcc_version: 10
|
||||||
|
cxx_version: 23
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Run CMake (configure, build, test)
|
||||||
|
uses: ./.github/workflows/cmake
|
||||||
|
with:
|
||||||
|
cmake_build_type: ${{ matrix.build_type }}
|
||||||
|
cmake_cxx_compiler: g++-${{ matrix.gcc_version }}
|
||||||
|
gsl_cxx_standard: ${{ matrix.cxx_version }}
|
||||||
|
|
||||||
|
clang:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
clang_version: [ 13, 14, 15 ]
|
||||||
|
build_type: [ Debug, Release ]
|
||||||
|
cxx_version: [ 14, 17, 20, 23 ]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Run CMake (configure, build, test)
|
||||||
|
uses: ./.github/workflows/cmake
|
||||||
|
with:
|
||||||
|
cmake_build_type: ${{ matrix.build_type }}
|
||||||
|
cmake_cxx_compiler: clang++-${{ matrix.clang_version }}
|
||||||
|
gsl_cxx_standard: ${{ matrix.cxx_version }}
|
||||||
|
|
||||||
|
xcode:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
xcode_version: [ '14.3.1', '15.4' ]
|
||||||
|
build_type: [ Debug, Release ]
|
||||||
|
cxx_version: [ 14, 17, 20, 23 ]
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: select xcode version
|
||||||
|
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode_version }}.app
|
||||||
|
|
||||||
|
- name: Run CMake (configure, build, test)
|
||||||
|
uses: ./.github/workflows/cmake
|
||||||
|
with:
|
||||||
|
cmake_build_type: ${{ matrix.build_type }}
|
||||||
|
cmake_cxx_compiler: clang++
|
||||||
|
gsl_cxx_standard: ${{ matrix.cxx_version }}
|
||||||
|
|
||||||
|
VisualStudio:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
generator: [ 'Visual Studio 16 2019', 'Visual Studio 17 2022' ]
|
||||||
|
image: [ windows-2019, windows-2022 ]
|
||||||
|
build_type: [ Debug, Release ]
|
||||||
|
extra_args: [ '', '-T ClangCL' ]
|
||||||
|
cxx_version: [ 14, 17, 20, 23 ]
|
||||||
|
exclude:
|
||||||
|
- generator: 'Visual Studio 17 2022'
|
||||||
|
image: windows-2019
|
||||||
|
- generator: 'Visual Studio 16 2019'
|
||||||
|
image: windows-2022
|
||||||
|
- generator: 'Visual Studio 16 2019'
|
||||||
|
cxx_version: 23
|
||||||
|
runs-on: ${{ matrix.image }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: microsoft/setup-msbuild@v2
|
||||||
|
|
||||||
|
- name: Run CMake (configure, build, test)
|
||||||
|
uses: ./.github/workflows/cmake
|
||||||
|
with:
|
||||||
|
cmake_generator: ${{ matrix.generator }}
|
||||||
|
cmake_build_type: ${{ matrix.build_type }}
|
||||||
|
gsl_cxx_standard: ${{ matrix.cxx_version }}
|
||||||
|
extra_cmake_args: ${{ matrix.extra_args }}
|
||||||
|
build_cmd: msbuild GSL.sln
|
||||||
|
test_cmd: ctest . --output-on-failure --no-compress-output
|
||||||
|
shell: pwsh
|
||||||
|
|
27
README.md
27
README.md
@ -86,24 +86,17 @@ This is based on [CppCoreGuidelines semi-specification](https://github.com/isocp
|
|||||||
|
|
||||||
# Quick Start
|
# Quick Start
|
||||||
## Supported Compilers / Toolsets
|
## Supported Compilers / Toolsets
|
||||||
The GSL officially supports the latest and previous major versions of VS with MSVC & LLVM, GCC, Clang, and XCode with Apple-Clang.
|
The GSL officially supports recent major versions of Visual Studio with both MSVC and LLVM, GCC, Clang, and XCode with Apple-Clang.
|
||||||
Within these two major versions, we try to target the latest minor updates / revisions (although this may be affected by
|
For each of these major versions, the GSL officially supports C++14, C++17, C++20, and C++23 (when supported by the compiler).
|
||||||
delays between a toolchain's release and when it becomes widely available for use).
|
Below is a table showing the versions currently being tested (also see [.github/workflows/compilers.yml](the workflow).)
|
||||||
Below is a table showing the versions currently being tested.
|
|
||||||
|
|
||||||
Compiler |Toolset Versions Currently Tested
|
Compiler |Toolset Versions Currently Tested
|
||||||
:------- |--:
|
:------- |--:
|
||||||
XCode | 13.2.1 & 12.5.1
|
GCC | 10, 11, 12
|
||||||
GCC | 11[^1] & 10[^2]
|
XCode | 14.3.1, 15.4
|
||||||
Clang | 12[^2] & 11[^2]
|
Clang | 13, 14, 15
|
||||||
Visual Studio with MSVC | VS2022[^3] & VS2019[^4]
|
Visual Studio with MSVC | VS2019, VS2022
|
||||||
Visual Studio with LLVM | VS2022[^3] & VS2019[^4]
|
Visual Studio with LLVM | VS2019, VS2022
|
||||||
|
|
||||||
|
|
||||||
[^1]: Precise version may be found in the [latest CI results](https://dev.azure.com/cppstat/GSL/_build?definitionId=1&branchFilter=26).
|
|
||||||
[^2]: Precise version may be found in the [latest CI results](https://dev.azure.com/cppstat/GSL/_build?definitionId=1&branchFilter=26). Should be the version specified [here](https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#language-and-runtime).
|
|
||||||
[^3]: Precise version may be found in the [latest CI results](https://dev.azure.com/cppstat/GSL/_build?definitionId=1&branchFilter=26). Should be the version specified [here](https://github.com/actions/virtual-environments/blob/main/images/win/Windows2022-Readme.md#visual-studio-enterprise-2022).
|
|
||||||
[^4]: Precise version may be found in the [latest CI results](https://dev.azure.com/cppstat/GSL/_build?definitionId=1&branchFilter=26). Should be the version specified [here](https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#visual-studio-enterprise-2019).
|
|
||||||
|
|
||||||
---
|
---
|
||||||
If you successfully port GSL to another platform, we would love to hear from you!
|
If you successfully port GSL to another platform, we would love to hear from you!
|
||||||
@ -216,3 +209,7 @@ target_link_libraries(foobar PRIVATE Microsoft.GSL::GSL)
|
|||||||
## Debugging visualization support
|
## Debugging visualization support
|
||||||
|
|
||||||
For Visual Studio users, the file [GSL.natvis](./GSL.natvis) in the root directory of the repository can be added to your project if you would like more helpful visualization of GSL types in the Visual Studio debugger than would be offered by default.
|
For Visual Studio users, the file [GSL.natvis](./GSL.natvis) in the root directory of the repository can be added to your project if you would like more helpful visualization of GSL types in the Visual Studio debugger than would be offered by default.
|
||||||
|
|
||||||
|
## See Also
|
||||||
|
|
||||||
|
For information on [Microsoft Gray Systems Lab (GSL)](https://aka.ms/gsl) of applied data management and system research see <https://aka.ms/gsl>.
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
trigger:
|
|
||||||
- main
|
|
||||||
|
|
||||||
pr:
|
|
||||||
autoCancel: true
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- stage: GCC
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: ./pipelines/jobs.yml
|
|
||||||
parameters:
|
|
||||||
compiler: gcc
|
|
||||||
image: ubuntu-20.04
|
|
||||||
compilerVersions: [ 11, 10 ]
|
|
||||||
setupfile: 'setup_gcc.yml'
|
|
||||||
|
|
||||||
- stage: Clang
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: ./pipelines/jobs.yml
|
|
||||||
parameters:
|
|
||||||
compiler: clang
|
|
||||||
image: ubuntu-20.04
|
|
||||||
compilerVersions: [ 12, 11 ]
|
|
||||||
setupfile: 'setup_clang.yml'
|
|
||||||
|
|
||||||
- stage: Xcode
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: ./pipelines/jobs.yml
|
|
||||||
parameters:
|
|
||||||
compiler: 'Xcode'
|
|
||||||
image: macOS-11
|
|
||||||
compilerVersions: [ '12.5.1', '13.2.1' ]
|
|
||||||
setupfile: 'setup_apple.yml'
|
|
||||||
|
|
||||||
- stage: VS_MSVC
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: ./pipelines/jobs.yml
|
|
||||||
parameters:
|
|
||||||
compiler: 'VS2019 (MSVC)'
|
|
||||||
compilerVersions: [ 'default' ]
|
|
||||||
image: windows-2019
|
|
||||||
- template: ./pipelines/jobs.yml
|
|
||||||
parameters:
|
|
||||||
compiler: 'VS2022 (MSVC)'
|
|
||||||
compilerVersions: [ 'default' ]
|
|
||||||
image: windows-2022
|
|
||||||
|
|
||||||
- stage: VS_LLVM
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: ./pipelines/jobs.yml
|
|
||||||
parameters:
|
|
||||||
compiler: 'VS2019 (LLVM)'
|
|
||||||
compilerVersions: [ 'default' ]
|
|
||||||
image: windows-2019
|
|
||||||
extraCmakeArgs: '-T ClangCL'
|
|
||||||
- template: ./pipelines/jobs.yml
|
|
||||||
parameters:
|
|
||||||
compiler: 'VS2022 (LLVM)'
|
|
||||||
compilerVersions: [ 'default' ]
|
|
||||||
image: windows-2022
|
|
||||||
extraCmakeArgs: '-T ClangCL'
|
|
@ -30,13 +30,12 @@ struct narrowing_error : public std::exception
|
|||||||
template <class T, class U, typename std::enable_if<std::is_arithmetic<T>::value>::type* = nullptr>
|
template <class T, class U, typename std::enable_if<std::is_arithmetic<T>::value>::type* = nullptr>
|
||||||
// clang-format off
|
// clang-format off
|
||||||
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(es.46) // NO-FORMAT: attribute // The warning suggests that a floating->unsigned conversion can occur
|
GSL_SUPPRESS(es.46) // NO-FORMAT: attribute // The warning suggests that a floating->unsigned conversion can occur
|
||||||
// in the static_cast below, and that gsl::narrow should be used instead.
|
// in the static_cast below, and that gsl::narrow should be used instead.
|
||||||
// Suppress this warning, since gsl::narrow is defined in terms of
|
// Suppress this warning, since gsl::narrow is defined in terms of
|
||||||
// static_cast
|
// static_cast
|
||||||
// clang-format on
|
// clang-format on
|
||||||
constexpr T narrow(U u) noexcept(false)
|
constexpr T narrow(U u)
|
||||||
{
|
{
|
||||||
constexpr const bool is_different_signedness =
|
constexpr const bool is_different_signedness =
|
||||||
(std::is_signed<T>::value != std::is_signed<U>::value);
|
(std::is_signed<T>::value != std::is_signed<U>::value);
|
||||||
@ -67,9 +66,8 @@ GSL_SUPPRESS(p.2) // NO-FORMAT: attribute // don't rely on undefined behavior
|
|||||||
template <class T, class U, typename std::enable_if<!std::is_arithmetic<T>::value>::type* = nullptr>
|
template <class T, class U, typename std::enable_if<!std::is_arithmetic<T>::value>::type* = nullptr>
|
||||||
// clang-format off
|
// clang-format off
|
||||||
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)
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
constexpr T narrow(U u) noexcept(false)
|
constexpr T narrow(U u)
|
||||||
{
|
{
|
||||||
const T t = narrow_cast<T>(u);
|
const T t = narrow_cast<T>(u);
|
||||||
|
|
||||||
|
@ -19,12 +19,11 @@
|
|||||||
|
|
||||||
#include "assert" // for Ensures, Expects
|
#include "assert" // for Ensures, Expects
|
||||||
|
|
||||||
#include <algorithm> // for forward
|
|
||||||
#include <cstddef> // for ptrdiff_t, nullptr_t, size_t
|
#include <cstddef> // for ptrdiff_t, nullptr_t, size_t
|
||||||
#include <memory> // for shared_ptr, unique_ptr
|
#include <functional> // for less, greater
|
||||||
#include <system_error> // for hash
|
#include <memory> // for shared_ptr, unique_ptr, hash
|
||||||
#include <type_traits> // for enable_if_t, is_convertible, is_assignable
|
#include <type_traits> // for enable_if_t, is_convertible, is_assignable
|
||||||
#include <utility> // for declval
|
#include <utility> // for declval, forward
|
||||||
|
|
||||||
#if !defined(GSL_NO_IOSTREAMS)
|
#if !defined(GSL_NO_IOSTREAMS)
|
||||||
#include <iosfwd> // for ostream
|
#include <iosfwd> // for ostream
|
||||||
|
@ -64,10 +64,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Turn off clang unsafe buffer warnings as all accessed are guarded by runtime checks
|
// Turn off clang unsafe buffer warnings as all accessed are guarded by runtime checks
|
||||||
#if defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")
|
#if defined(__clang__)
|
||||||
|
#if __has_warning("-Wunsafe-buffer-usage")
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
|
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
|
||||||
#endif // defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")
|
#endif // __has_warning("-Wunsafe-buffer-usage")
|
||||||
|
#endif // defined(__clang__)
|
||||||
|
|
||||||
namespace gsl
|
namespace gsl
|
||||||
{
|
{
|
||||||
@ -852,8 +854,10 @@ as_writable_bytes(span<ElementType, Extent> s) noexcept
|
|||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif // __GNUC__ > 6
|
#endif // __GNUC__ > 6
|
||||||
|
|
||||||
#if defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")
|
#if defined(__clang__)
|
||||||
|
#if __has_warning("-Wunsafe-buffer-usage")
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
#endif
|
#endif // __has_warning("-Wunsafe-buffer-usage")
|
||||||
|
#endif // defined(__clang__)
|
||||||
|
|
||||||
#endif // GSL_SPAN_H
|
#endif // GSL_SPAN_H
|
||||||
|
@ -41,10 +41,12 @@
|
|||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
// Turn off clang unsafe buffer warnings as all accessed are guarded by runtime checks
|
// Turn off clang unsafe buffer warnings as all accessed are guarded by runtime checks
|
||||||
#if defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")
|
#if defined(__clang__)
|
||||||
|
#if __has_warning("-Wunsafe-buffer-usage")
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
|
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
|
||||||
#endif // defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")
|
#endif // __has_warning("-Wunsafe-buffer-usage")
|
||||||
|
#endif // defined(__clang__)
|
||||||
|
|
||||||
#if defined(__cplusplus) && (__cplusplus >= 201703L)
|
#if defined(__cplusplus) && (__cplusplus >= 201703L)
|
||||||
#define GSL_NODISCARD [[nodiscard]]
|
#define GSL_NODISCARD [[nodiscard]]
|
||||||
@ -160,8 +162,10 @@ constexpr auto at(std::span<T, extent> sp, const index i) -> decltype(sp[sp.size
|
|||||||
|
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
#if defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")
|
#if defined(__clang__)
|
||||||
|
#if __has_warning("-Wunsafe-buffer-usage")
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
#endif
|
#endif // __has_warning("-Wunsafe-buffer-usage")
|
||||||
|
#endif // defined(__clang__)
|
||||||
|
|
||||||
#endif // GSL_UTIL_H
|
#endif // GSL_UTIL_H
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
parameters:
|
|
||||||
CXXVersions: [ 14, 17, 20 ]
|
|
||||||
buildTypes: [ 'Debug', 'Release' ]
|
|
||||||
image: ''
|
|
||||||
|
|
||||||
compiler: ''
|
|
||||||
compilerVersions: ["default"] # if default value, simply uses whatever version is on the machine.
|
|
||||||
# the text of this default value doesn't actually matter.
|
|
||||||
setupfile: ''
|
|
||||||
extraCmakeArgs: ''
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
- ${{ each compilerVersion in parameters.compilerVersions }}:
|
|
||||||
- ${{ each CXXVersion in parameters.CXXVersions }}:
|
|
||||||
- ${{ each buildType in parameters.buildTypes }}:
|
|
||||||
- job:
|
|
||||||
displayName: ${{ format('{0} {1} C++{2} {3}', parameters.compiler, compilerVersion, CXXVersion, buildType) }}
|
|
||||||
pool:
|
|
||||||
vmImage: ${{ parameters.image }}
|
|
||||||
continueOnError: false
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- ${{ if not(eq(parameters.setupfile, '')) }}:
|
|
||||||
- template: ${{ parameters.setupfile }}
|
|
||||||
parameters:
|
|
||||||
version: ${{ compilerVersion }}
|
|
||||||
|
|
||||||
- task: CMake@1
|
|
||||||
name: Configure
|
|
||||||
inputs:
|
|
||||||
workingDirectory: build
|
|
||||||
cmakeArgs: '-DGSL_CXX_STANDARD=${{ CXXVersion }} -DCMAKE_BUILD_TYPE=${{ buildType }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev ${{ parameters.extraCmakeArgs }} .. '
|
|
||||||
|
|
||||||
- task: CMake@1
|
|
||||||
name: Build
|
|
||||||
inputs:
|
|
||||||
workingDirectory: build
|
|
||||||
cmakeArgs: '--build . '
|
|
||||||
|
|
||||||
- script: ctest . --output-on-failure --no-compress-output
|
|
||||||
name: CTest
|
|
||||||
workingDirectory: build
|
|
||||||
failOnStderr: true
|
|
@ -1,9 +0,0 @@
|
|||||||
parameters:
|
|
||||||
version: 0
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- script: |
|
|
||||||
if [ "${{ parameters.version }}" != "default" ]; then sudo xcode-select -switch /Applications/Xcode_${{ parameters.version }}.app; fi
|
|
||||||
|
|
||||||
displayName: "Setup Xcode Version"
|
|
||||||
failOnStderr: true
|
|
@ -1,13 +0,0 @@
|
|||||||
parameters:
|
|
||||||
version: 0
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- script: |
|
|
||||||
echo "##vso[task.setvariable variable=CXX;]${CXX}"
|
|
||||||
echo "##vso[task.setvariable variable=CC;]${CC}"
|
|
||||||
|
|
||||||
displayName: "Setup Clang Version"
|
|
||||||
failOnStderr: true
|
|
||||||
env:
|
|
||||||
CC: clang-${{ parameters.version }}
|
|
||||||
CXX: clang++-${{ parameters.version }}
|
|
@ -1,14 +0,0 @@
|
|||||||
parameters:
|
|
||||||
version: 0
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- script: |
|
|
||||||
echo "##vso[task.setvariable variable=CXX;]${CXX}"
|
|
||||||
echo "##vso[task.setvariable variable=CC;]${CC}"
|
|
||||||
if [ "${{ parameters.version }}" = "11" ]; then sudo apt-get install $CXX; fi
|
|
||||||
|
|
||||||
displayName: "Setup GCC Version"
|
|
||||||
failOnStderr: true
|
|
||||||
env:
|
|
||||||
CC: gcc-${{ parameters.version }}
|
|
||||||
CXX: g++-${{ parameters.version }}
|
|
@ -146,6 +146,7 @@ else()
|
|||||||
-Wno-global-constructors # GTest
|
-Wno-global-constructors # GTest
|
||||||
-Wno-missing-prototypes
|
-Wno-missing-prototypes
|
||||||
-Wno-padded
|
-Wno-padded
|
||||||
|
-Wno-switch-default
|
||||||
-Wno-unknown-attributes
|
-Wno-unknown-attributes
|
||||||
-Wno-used-but-marked-unused # GTest EXPECT_DEATH
|
-Wno-used-but-marked-unused # GTest EXPECT_DEATH
|
||||||
-Wno-weak-vtables
|
-Wno-weak-vtables
|
||||||
|
Loading…
Reference in New Issue
Block a user