Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/GSL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-09-29Properly handle finally(actual_function) (#1056)final_action-revisionCasey Carter
`finally` needs to use `decay_t` instead of `remove_cvref_t` so it can properly accept non-object function arguments by decaying to function pointer type. Adds test coverage for this use case which was previously missing.
2022-09-27Merge remote-tracking branch 'origin/main' into final_action-revisionDmitry Kobets
2022-09-01Add `remove_cv` too per Casey's suggestionHerb Sutter
Co-authored-by: Casey Carter <Casey@Carter.net>
2022-09-01Applying Casey's an Dmitry's changes...Herb Sutter
2022-08-31Made `noexcept`-consistentHerb Sutter
2022-08-31Applying Casey's suggestionsHerb Sutter
Applying @CaseyCarter's suggested forwarding changes And adding `[[nodiscard]]` on `finally` Thanks Casey -- somehow this slipped through the cracks for a year.
2022-08-18solve span compile problem with gcc 5.5.0 (#1052)Werner Henze
GCC 4.8.0 - 7.0 has a bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480) involving specialization in a namespace enclosing the specialized template. This PR fixes an appearance of this bug in the span header.
2022-08-17Use updated NDK version in android test suite (#1053)dmitrykobets-msft
https://github.com/actions/runner-images/issues/5930 recently updated the NDK version, resulting in test breakages. Update the version.
2022-07-19Resolve MSVC warning C5260 (#1049)dmitrykobets-msft
* Test solution * Mark dynamic_extent as inline, compiler-version-permitting
2022-05-24Microsoft mandatory file (#1047)microsoft-github-policy-service[bot]
Co-authored-by: microsoft-github-policy-service[bot] <77245923+microsoft-github-policy-service[bot]@users.noreply.github.com>
2022-04-29Remove useless runtime checks in span implementation (#1029)dmitrykobets-msft
Both checks for Expects(ExtentType::size() != dynamic_extent); in storage_type are always useless. storage_type<ExtentType> is only ever created with ExtentType == extent_type<Extent>, where Extent has type std::size_t and is the extent of the span. Looking at extent_type<std::size_t Ext>::size(): - if Ext != dynamic_extent, then size() always returns Ext, and therefore size() != dynamic_extent - if Ext == dynamic_extent, then size() returns extent_type<dynamic_extent>::size_. size_ can only be set via one of two constructors: - constexpr explicit extent_type(size_type size), which already does the check in question - constexpr explicit extent_type(extent_type<Other> ext) : size_(ext.size()), which simply relies on the other extent's size() method So there is no way for ExtentType::size() == dynamic_extent.
2022-04-28Suppress es.46 warning in implementation of gsl::narrow (#1046)dmitrykobets-msft
As per the CoreGuidelines, gsl::narrow is defined in terms of static_cast. Suppress es.46, which suggests converting the static_cast into gsl::narrow
2022-04-28Fix reason for including assert inside gsl/narrow (#1045)dmitrykobets-msft
2022-04-27gsl/narrow should include <exception> (#1044)Juan Carlos Arevalo Baeza
This file uses std::exception, so it should include the appropriate header. Normally it gets the STL's <exception> header included via the gsl/assert file, but this is skipped with _HAS_EXCEPTIONS=0. I understand _HAS_EXCEPTIONS is undocumented and unsupported, but regardless, the appropriate header should be included here. Alternatively, gsl/narrow should be modified to support _HAS_EXCEPTIONS=0, like gsl/assert was. But I'm not proposing that change. <exception> does define std::exception even with _HAS_EXCEPTIONS=0.
2022-04-14Suppress -Wfloat-equal warning in implementation of gsl::narrow (#1043)dmitrykobets-msft
In the implementation of gsl::narrow, there is a comparison `static_cast<U>(t) != u` which may be comparing two floats. The comparison here is done purposefully to categorize ill effects of narrowing conversion, since the values being compared *should* be the same when compared with `operator==`. Note, using #pragma GCC will suppress this warning for both GCC and Clang.
2022-03-22Make gsl::span's iterators use the contiguous_iterator concept (#1035)dmitrykobets-msft
Resolves #1016 Co-authored-by: Casey Carter <Casey@Carter.net>
2022-03-22Suppress reserved identifier warning (#1041)dmitrykobets-msft
The following reserved identifiers are being used specifically to target certain MSVC constructs, so suppress the warning in VS 2022 (LLVM) "... is reserved because it starts with '_' followed by a capital letter": - _Unchecked_type - _Verify_range - _Verify_offset - _Unwrapped - _Unwrap_when_unverified - _Seek_to - _Unchecked_begin - _Unchecked_end
2022-02-01quoted form of #include when GSL includes GSL files (#1030)Werner Henze
[SF.12: Prefer the quoted form of #include for files relative to the including file and the angle bracket form everywhere else](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rs-incform) Additionally changed #include order in `span` so that all `span_ext` is in the GSL include block and not in the STL include block. Fixes issues #1025. Co-authored-by: Werner Henze <w.henze@avm.de>
2022-01-29Fixed wrong version number in exported CMake configs. (#1027)v4.0.0Vitaly Zaitsev
2022-01-27Document safe usage of undefined behavior in gsl::narrow (#1024)dmitrykobets-msft
2022-01-06Update compiler support (#1021)dmitrykobets-msft
Bump clang and Xcode supported versions and add support for VS with LLVM
2021-12-10Update compiler support (#1019)dmitrykobets-msft
2021-12-10Fix/implement C++2020 compilation, tests, and CI (#1017)dmitrykobets-msft
* Fix C++20 bugs and tests * Rework CI for C++2020 tests * Update readme compiler versions
2021-11-17Fix googletest build failure with gcc 11.1+ (#1015)dmitrykobets-msft
2021-10-27Delete .travis.yml (#995)Jordan Maples
2021-10-27make zstring family don't require empty angle brackets any more (#998)Werner Henze
Co-authored-by: Werner Henze <werner.henze+gitcommits@posteo.de>
2021-09-16Fix gsl/util for c++20 compilers without <span> (#993)Jean-Michaël Celerier
For instance, clang 10 sets __cplusplus >= 202002L yet does not have span, which causes build errors: https://gcc.godbolt.org/z/Yq345zGea
2021-06-24feat: narrow for non totally ordered types (#986)Johel Ernesto Guerrero Peña
2021-05-21gsl::at behavior change regarding gsl::span (#985)Jordan Maples [MSFT]
* move span specialization of 'at' to <gsl/span> and update the parameter to be taken by reference * undid previous changes and acted upon decisions made in maintainer sync. Fixed tests failing in /kernel mode * ran clang-format on the include folder * ran clang-format on the test folder Co-authored-by: Jordan Maples <jordan.maples@microsoft.com>
2021-05-13Fix iPhone simulator CI (#981)Tushar Maheshwari
* Run iOS simulator CI * Fix link errors - scope function linkage using anonymous namespace * Update noexcept test for consistency
2021-02-25Fine, make it move-constructible (only)Herb Sutter
To satisfy some compilers. And might as well reinstate that test case.
2021-02-25Figured out test failures, removed move testHerb Sutter
We shouldn't be moving these `final_action`s around, that wasn't part of the C++CG design requirements. Went back to the simple version of `final_action`.
2021-02-25Defaulted copyingHerb Sutter
2021-02-25Restored copyability to final_actionHerb Sutter
2021-02-25Clean up `final_act` and `finally`, closes #752 and #846Herb Sutter
2021-02-25is_comparable_to_nullptr for better static_assert (#975)beinhaerter
* is_comparable_to_nullptr for better static_assert Trying `gsl::not_null<char> p2{ 0 };` on VS2019 the current implementation would trigger >error C2446 : '!=' : no conversion from 'nullptr' to 'int' >message: A native nullptr can only be converted to bool or , using reinterpret_cast, to an integral type >message: see reference to class template instantiation 'gsl::not_null<char>' being compiled >error C2955 : 'std::is_convertible' : use of class template requires template argument list >message: see declaration of 'std::is_convertible' >error C2039 : 'value' : is not a member of 'std::is_convertible<_From,_To>' >error C2065 : 'value' : undeclared identifier The new implementation gives much shorter and clearer message and does exactly as the `static_assert` intends to do: > error C2338: T cannot be compared to nullptr. > message : see reference to class template instantiation 'gsl::not_null<char *>' being compiled * Update include/gsl/pointers Co-authored-by: Casey Carter <cartec69@gmail.com> Co-authored-by: Werner Henze <w.henze@avm.de> Co-authored-by: Casey Carter <cartec69@gmail.com>
2021-02-24Branch rename cleanup (#976)Jordan Maples [MSFT]
* Update pipeline build tag The build status was still looking for a "master" branch, updated it to point to "main" * Update ios.yml * Update android.yml * Update azure-pipelines.yml * Update CONTRIBUTING.md
2021-01-20Fixing cmake developer warning (#972)jpr89
Here is the warning currently being produced: CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/GNUInstallDirs.cmake:223 (message): Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. Please enable at least one language before including GNUInstallDirs. Call Stack (most recent call first): cmake/guidelineSupportLibrary.cmake:20 (include) CMakeLists.txt:4 (include) This warning is for project developers. Use -Wno-dev to suppress it. I noted how I fixed the error. This is caused by GNUInstallDirs automatically executing code just by including it. I also added -Werror=dev to the CI to ensure this never happens again. Co-authored-by: Juan Ramos <juanr0911@gmail.com>
2021-01-08Improve build script for standalone tests (#963)Nicholas Guriev
* Require Git for build tests only if installed GTest is not found Cloning via Git is not the only path to obtain Google Test framework. In Linux, using a system package manager is the preferred way, and gtest can be installed through APK, APT, DNF, pacman, or many other. Now we make Git mandatory after checking GTest existence. See also: https://github.com/microsoft/GSL/pull/961#discussion_r548959056 * Support standalone tests The patch makes possible to run auto-tests against globally installed GSL, ignoring local headers. To do this, run CMake in the tests/ folder. cmake -B build -S tests -DGSL_CXX_STANDARD=14 This feature should not break existing build recipes. Co-authored-by: Nicholas Guriev <nicholas@guriev.su>
2021-01-08Minor cmake nitpicks (#969)hdf89shfdfs
It's much nicer and less error prone to just use add_subdirectory to establish the include directory. Hide the GNUInstallDirs module by placing it in the helper module. The intent being that the main CMakeLists.txt should have a little code as possible. So that readers can quickly understand the project. Use include_guard() when available in cmake 3.10+ Co-authored-by: Juan Ramos <juanr0911@gmail.com>
2021-01-08Update README.md (#970)hdf89shfdfs
Mention the new FetchContent functionality cmake offers. And provide a usable example. Co-authored-by: Juan Ramos <juanr0911@gmail.com>
2021-01-05Reintroduce CMake changes that were reverted in #966 (#967)Jordan Maples [MSFT]
* [cmake] Adding options for INSTALL and TEST (#964) * [cmake] Adding GSL_INSTALL option Not all consumers of GSL automatically want to have this install logic. It's good practice to gate install logic behind an option. For an example look at magic_enum: https://github.com/Neargye/magic_enum/blob/master/CMakeLists.txt If the client wants to install GSL they still can. But they should ask for it by overriding GSL_INSTALL. * Update cmake/guidelineSupportLibrary.cmake added nl@eof * Update CMakeLists.txt * Update CMakeLists.txt Co-authored-by: Juan Ramos <juanr0911@gmail.com> Co-authored-by: Jordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com> * missing config line restored by moving GNUInstallDirs back to main file Co-authored-by: hdf89shfdfs <31327577+hdf89shfdfs@users.noreply.github.com> Co-authored-by: Juan Ramos <juanr0911@gmail.com>
2021-01-05Revert "[cmake] Adding options for INSTALL and TEST (#964)" (#966)Jordan Maples [MSFT]
This reverts commit eca0eca6f1ae12c80f73bdfb73bbcf912289fe34.
2021-01-04update gtest (#965)Jordan Maples [MSFT]
2021-01-04[cmake] Adding options for INSTALL and TEST (#964)hdf89shfdfs
* [cmake] Adding GSL_INSTALL option Not all consumers of GSL automatically want to have this install logic. It's good practice to gate install logic behind an option. For an example look at magic_enum: https://github.com/Neargye/magic_enum/blob/master/CMakeLists.txt If the client wants to install GSL they still can. But they should ask for it by overriding GSL_INSTALL. * Update cmake/guidelineSupportLibrary.cmake added nl@eof * Update CMakeLists.txt * Update CMakeLists.txt Co-authored-by: Juan Ramos <juanr0911@gmail.com> Co-authored-by: Jordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com>
2020-12-19Delete appveyor.ymlJordan Maples [MSFT]
2020-12-15Minor cmake changes (#961)hdf89shfdfs
Abstract adding natvis file. Move call to find_package(Git) as well as making it required/quiet.
2020-12-10remove multi_span (#958)Jordan Maples [MSFT]
2020-12-03Remove unneccesssary compile definitions (#957)hdf89shfdfs
2020-11-24Change build status badges (#955)Jordan Maples [MSFT]
Using Azure Pipelines badge instead of the Travis-ci and Appveyor badges.