Commit Graph

921 Commits

Author SHA1 Message Date
dmitrykobets-msft
f22f524aa2
Suppress reserved identifier warning (#1041)
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-03-22 12:24:23 -07:00
Werner Henze
4377f6e603
quoted form of #include when GSL includes GSL files (#1030)
[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-31 13:06:42 -08:00
Vitaly Zaitsev
a353456718
Fixed wrong version number in exported CMake configs. (#1027) 2022-01-28 15:22:59 -08:00
dmitrykobets-msft
99a29ce797
Document safe usage of undefined behavior in gsl::narrow (#1024) 2022-01-26 16:44:07 -08:00
dmitrykobets-msft
ebf0498363
Update compiler support (#1021)
Bump clang and Xcode supported versions and add support for VS with LLVM
2022-01-06 10:17:21 -08:00
dmitrykobets-msft
c412deb31e
Update compiler support (#1019) 2021-12-10 11:17:47 -08:00
dmitrykobets-msft
bcf008ae55
Fix/implement C++2020 compilation, tests, and CI (#1017)
* Fix C++20 bugs and tests
* Rework CI for C++2020 tests
* Update readme compiler versions
2021-12-09 14:54:06 -08:00
dmitrykobets-msft
e0880931ae
Fix googletest build failure with gcc 11.1+ (#1015) 2021-11-17 12:24:40 -08:00
Jordan Maples
c31a9ad5e8
Delete .travis.yml (#995) 2021-10-26 16:52:07 -07:00
Werner Henze
da80ce15d8
make zstring family don't require empty angle brackets any more (#998)
Co-authored-by: Werner Henze <werner.henze+gitcommits@posteo.de>
2021-10-26 16:50:58 -07:00
Jean-Michaël Celerier
f09b24970d
Fix gsl/util for c++20 compilers without <span> (#993)
For instance, clang 10 sets __cplusplus >= 202002L yet does not have span, which causes build errors:

https://gcc.godbolt.org/z/Yq345zGea
2021-09-15 15:12:11 -07:00
Johel Ernesto Guerrero Peña
8a4b9ed0bf
feat: narrow for non totally ordered types (#986) 2021-06-23 15:28:45 -07:00
Jordan Maples [MSFT]
b26f6d5ec7
gsl::at behavior change regarding gsl::span (#985)
* 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-20 18:18:08 -07:00
Tushar Maheshwari
c1cbb41b42
Fix iPhone simulator CI (#981)
* Run iOS simulator CI

* Fix link errors

- scope function linkage using anonymous namespace

* Update noexcept test for consistency
2021-05-13 10:52:09 -07:00
beinhaerter
ef0ffefe52
is_comparable_to_nullptr for better static_assert (#975)
* 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-24 14:39:13 -08:00
Jordan Maples [MSFT]
176c92e802
Branch rename cleanup (#976)
* 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-02-24 11:16:21 -08:00
jpr89
84aeb59f26
Fixing cmake developer warning (#972)
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-19 13:41:25 -08:00
Nicholas Guriev
d9fa328f89
Improve build script for standalone tests (#963)
* 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-08 10:55:59 -08:00
hdf89shfdfs
d0052f6320
Minor cmake nitpicks (#969)
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-08 09:56:04 -08:00
hdf89shfdfs
3b3478eaf8
Update README.md (#970)
Mention the new FetchContent functionality cmake offers. And provide a usable example.

Co-authored-by: Juan Ramos <juanr0911@gmail.com>
2021-01-07 14:02:47 -08:00
Jordan Maples [MSFT]
e427b02c89
Reintroduce CMake changes that were reverted in #966 (#967)
* [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-05 11:55:13 -08:00
Jordan Maples [MSFT]
25bb4bd948
Revert "[cmake] Adding options for INSTALL and TEST (#964)" (#966)
This reverts commit eca0eca6f1.
2021-01-04 14:17:03 -08:00
Jordan Maples [MSFT]
1c509ad8e1
update gtest (#965) 2021-01-04 11:31:01 -08:00
hdf89shfdfs
eca0eca6f1
[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>
2021-01-04 10:42:33 -08:00
Jordan Maples [MSFT]
a47352cb2a
Delete appveyor.yml 2020-12-18 13:03:34 -08:00
hdf89shfdfs
d15cb5fdbe
Minor cmake changes (#961)
Abstract adding natvis file.

Move call to find_package(Git) as well as making it required/quiet.
2020-12-15 10:06:46 -08:00
Jordan Maples [MSFT]
a6cef6bc6c
remove multi_span (#958) 2020-12-09 15:18:07 -08:00
hdf89shfdfs
ec6cd75d57
Remove unneccesssary compile definitions (#957) 2020-12-02 14:12:38 -08:00
Jordan Maples [MSFT]
0140ab1d73
Change build status badges (#955)
Using Azure Pipelines badge instead of the Travis-ci and Appveyor badges.
2020-11-23 16:11:40 -08:00
hdf89shfdfs
475b785d2c
Use CMAKE_CXX_STANDARD when available (#953)
* Use CMAKE_CXX_STANDARD when available

If the use has provided the variable CMAKE_CXX_STANDARD use that instead of providing a default cache variable.

* Typo
2020-11-16 14:05:33 -08:00
Jordan Maples [MSFT]
959ce58bbc
Update gsl (#954) 2020-11-16 09:31:12 -08:00
Jordan Maples [MSFT]
804a14fe8b
Update README.md
update the supported matrix
2020-11-11 13:52:11 -08:00
beinhaerter
00d4a5aab6
suppress bounds.1 (#950)
Suppress "warning C26481: Don't use pointer arithmetic. Use span instead (bounds.1)."

Co-authored-by: Werner Henze <werner.henze+gitcommits@posteo.de>
2020-11-11 13:47:58 -08:00
Jordan Maples [MSFT]
9150ce9a95
Adding std::hash<not_null<T>> tests to notnull_tests.cpp (#947)
* added std::hash<not_null> tests

* nl
2020-11-03 16:56:09 -08:00
Jordan Maples [MSFT]
a150aaa4ed
renaming main logic files. Added warning message of the removal and include passthrough. Renamed includes in the source files. Ran Clang-Format (#946)
Header rename
2020-10-29 17:38:48 -07:00
Jordan Maples [MSFT]
e8978c01ab
Remove deprecation of basic_zstring et al (#945)
* 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-29 11:34:05 -07:00
Jordan Maples [MSFT]
2c3ab0211c
Fix C26481 warning in span array ctor (#944)
* 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-29 10:54:37 -07:00
Jordan Maples [MSFT]
179fba51f5
Azure pipeline (#8) (#943) 2020-10-28 16:35:49 -07:00
Jordan Maples [MSFT]
d74ae54b60
Update README.md
Closes #911
2020-10-28 15:47:06 -07:00
bowie7070
b6c57e2403
Include gsl_narrow from gsl and fix comment. (#939)
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-28 15:38:32 -07:00
mtnpke
736b62a838
Allow usage on platforms not providing iostreams (#935)
Closes #933.
2020-10-28 15:37:02 -07:00
Jordan Maples [MSFT]
6f4529395c
Merge pull request #941 from JordanMaples/cmake_update
added GSL_ prefix to VS_ADD_NATIVE_VISUALIZERS
2020-10-26 10:12:40 -07:00
Jordan Maples [MSFT]
9fa2c5d5b9
Merge pull request #942 from tjs137/patch-1
use `narrow_cast`
2020-10-26 10:06:20 -07:00
tjs137
8009a703c2
use narrow_cast 2020-10-24 19:44:06 -04:00
Jordan Maples
cfb4db0c1e added GSL_ prefix to VS_ADD_NATIVE_VISUALIZERS 2020-10-22 15:40:27 -07:00
Jordan Maples [MSFT]
6432f920ea
Merge pull request #937 from beinhaerter/cast_warning
eliminate warning, use narrow_cast instead of static_cast
2020-10-20 10:55:05 -07:00
beinhaerter
2af9b11fe9
Update include/gsl/span
Co-authored-by: Jordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com>
2020-10-20 00:44:11 +02:00
beinhaerter
dc6fdff4c0
Update include/gsl/span
Co-authored-by: Jordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com>
2020-10-20 00:44:02 +02:00
Werner Henze
2ccf36b4b9 eliminate warning, use narrow_cast instead of static_cast 2020-10-14 15:04:50 +02:00
Jordan Maples [MSFT]
bd23bdc0ad
Merge pull request #931 from JordanMaples/deprecate-string_span
Deprecate string_span
2020-10-02 12:36:09 -07:00