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-11-08Fix GSL_SUPPRESS definition when nvcc is in-use (#1064)HEADmainChangming Sun
2022-11-01clang-tidy: performance-noexcept-move-constructor (#1063)jpr42
I ran GSL through clang-tidy with the performance-* checks https://releases.llvm.org/15.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/performance/noexcept-move-constructor.html
2022-10-18CMake cleanup (#1060)jpr42
- Move all install logic inside gsl_install.cmake - This makes reading the logic easier, and avoids the enable language issue with `GNUInstallDirs` by having it included after the project call - Have all functions inside gsl_functions.cmake - Use CMake idiom PROJECT_IS_TOP_LEVEL - Update README.md
2022-10-12Prevent inefficient copying when using not_null::get (#1059)dmitrykobets-msft
Closes issue #550, which highlighted overhead in not_null::get for larger types such as shared_ptr. Every call to get would return a copy of the contained value. This PR implements Herb's suggestion for changing the return type of not_null::get. The not_null's value will now only be copied if it is "trivially copyable"; otherwise, it will be returned by const reference. Note: this change also forces the returned copy to be const.
2022-10-11Clean up `final_act` and `finally`, closes #846 (#977)Herb Sutter
Somewhere along the way, GSL's implementation of final_act and finally seems to have become way overthought. This PR is to re-simplify these facilities back to what C++ Core Guidelines C.30 said which is simple and clear and works. It just copies the invocable thing, and doesn't bother trying to optimize the copy. This should be fine, because we're typically passing something that's cheap to copy, often a stateless lambda. The problem in #846 appears to be because finally looks like was originally written as a const&/&& overload (its state at the time that issue was opened)... to eliminate a copy when you invoke it with a temporary. If so, then the && was probably never intended to be a forwarder, but an rvalue reference that tripped over the horrid C++ syntax collision where a && parameter magically instead means a forwarding reference because the type happens to be a template parameter type here. So I suspect the original author was just trying to write an rvalue overload, and the forwarder that's there now was never intended at all.
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-07-19Resolve MSVC warning C5260 (#1049)dmitrykobets-msft
* Test solution * Mark dynamic_extent as inline, compiler-version-permitting
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-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-27Document safe usage of undefined behavior in gsl::narrow (#1024)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-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-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-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>
2020-12-10remove multi_span (#958)Jordan Maples [MSFT]
2020-11-16Update gsl (#954)Jordan Maples [MSFT]
2020-11-12suppress bounds.1 (#950)beinhaerter
Suppress "warning C26481: Don't use pointer arithmetic. Use span instead (bounds.1)." Co-authored-by: Werner Henze <werner.henze+gitcommits@posteo.de>
2020-10-30renaming main logic files. Added warning message of the removal and include ↵Jordan Maples [MSFT]
passthrough. Renamed includes in the source files. Ran Clang-Format (#946) Header rename
2020-10-29Remove deprecation of basic_zstring et al (#945)Jordan Maples [MSFT]
* Azure pipeline (#8) * azure-pipeline test * nl @ eof * trimming the pipeline and adding debug steps * removing redundant lines * change ctest to script cmd and remove debug * removed bad char * added dir change for ctest * explicit output file and cmake standard * test cat * more ctest tests * injecting failure in test for validation * another test * removing bad test * massive matrix * added parallel * commenting everything but xcode out for testing purposes * uncomment the other tests * testing some variables * rename * changed macos versions * adding one more layer of templates * fixing jobs.yml * idk what i'm doing * slight modifications * maybe some spaces will help * removing 'variables.' * another test * adding back pr w/ autocancel * adding failing test to validate error = failing task * remove failing test * trigger master * nl in steps.yml * removing deprecation of basic_zstring and derived types. only *string_span should have been deprecated
2020-10-29Fix C26481 warning in span array ctor (#944)Jordan Maples [MSFT]
* Azure pipeline (#8) * azure-pipeline test * nl @ eof * trimming the pipeline and adding debug steps * removing redundant lines * change ctest to script cmd and remove debug * removed bad char * added dir change for ctest * explicit output file and cmake standard * test cat * more ctest tests * injecting failure in test for validation * another test * removing bad test * massive matrix * added parallel * commenting everything but xcode out for testing purposes * uncomment the other tests * testing some variables * rename * changed macos versions * adding one more layer of templates * fixing jobs.yml * idk what i'm doing * slight modifications * maybe some spaces will help * removing 'variables.' * another test * adding back pr w/ autocancel * adding failing test to validate error = failing task * remove failing test * trigger master * nl in steps.yml * remove forced decay of array reference to pointer in span array ctor
2020-10-29Include gsl_narrow from gsl and fix comment. (#939)bowie7070
narrow() is now in gsl_narrow rather than gsl_util. Include gsl_narrow when exceptions are enabled. Ensures that #include <gsl/gsl> includes entire library as advertised in the documentation. Co-authored-by: Bowie Owens <bowie.owens@csiro.au>
2020-10-29Allow usage on platforms not providing iostreams (#935)mtnpke
Closes #933.
2020-10-25use `narrow_cast`tjs137
2020-10-20Update include/gsl/spanbeinhaerter
Co-authored-by: Jordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com>
2020-10-20Update include/gsl/spanbeinhaerter
Co-authored-by: Jordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com>
2020-10-14eliminate warning, use narrow_cast instead of static_castWerner Henze
2020-10-02fixed botched formattingJordan Maples
2020-10-02ran clang-format over string_spanJordan Maples
2020-10-02added deprecation messageJordan Maples
2020-10-01initial deprecation of all types in string_spanJordan Maples
2020-09-15add what to narrowing_errorJordan Maples
2020-08-27constexpr string_span stuffJordan Maples
2020-08-27adding changes suggested by Jonathan WakelyJordan Maples
2020-08-21Merge pull request #913 from jwakely/notnull_hashJordan Maples [MSFT]
Pass correct value to std::hash
2020-08-14Fix finally with mutable lvalue invokablePascal Menuet
2020-08-14Merge pull request #910 from JordanMaples/exception_fix_new_fileJordan Maples [MSFT]
exception free - Version 2
2020-08-13Pass correct value to std::hashJonathan Wakely
2020-08-13Fix comment typosJonathan Wakely
2020-08-13Merge branch 'master' into exception_fix_new_fileJordan Maples
2020-08-13Merge pull request #908 from JordanMaples/fix_nodiscard_in_finally_macroJordan Maples [MSFT]
Finally [[nodiscard]] - Version 2
2020-08-13Merge pull request #676 from ericLemanissier/patch-3Jordan Maples [MSFT]
fix requirement on not_null template
2020-08-12forgot newline at eof.Jordan Maples