Commit Graph

911 Commits

Author SHA1 Message Date
Herb Sutter
070db845f8 Add -Wno-global-constructors for Clang 2020-12-18 12:10:36 -08:00
Herb Sutter
0c5a66b666 Added workaround for non-constexpr std::exchange 2020-12-18 12:02:42 -08:00
Herb Sutter
248a7cbdce Add feature test for literal constructor in downlevel compilers 2020-12-18 11:56:36 -08:00
Herb Sutter
b77eaa87ee Make contract_group a literal type 2020-12-18 11:40:50 -08:00
Herb Sutter
9033021831 Removed stray .exchange 2020-12-18 11:34:25 -08:00
Herb Sutter
a45265a75e Handler shouldn't be internally synchronized 2020-12-18 11:30:17 -08:00
Herb Sutter
8bd828744f Remove constexpr again to see what the failures were 2020-12-18 11:25:04 -08:00
Herb Sutter
1c37688ccd Replaced some of the previous workarounds with feature tests
As always with feature tests, they can only be used to aggressively adopt new features even before all compilers we need have the features -- the test lets us write a vestigial workaround for downllevel compilers, to be removed as soon as all compilers support the feature.
2020-12-18 11:20:03 -08:00
Herb Sutter
8dfd03feeb Remove constexpr from contract_group constructor 2020-12-17 13:19:29 -08:00
Herb Sutter
d83e9ea05f Add workarounds for Android compiler and constexpr test 2020-12-17 12:11:42 -08:00
Herb Sutter
59f38376b9 Change auto to void to satisfy some compilers about definition ordering 2020-12-17 12:03:59 -08:00
Herb Sutter
dd45e5cfbd Went back to old-style declaration for older compilers that don't do C++17 guaranteed copy elision
A concession to older compilers.
2020-12-17 11:58:53 -08:00
Herb Sutter
0cbb9e221d Removed double .load
Require `chandler` to be never null by installing `[]()noexcept{}` as the handler if given a null pointer.
This lets us remove the double test in `assertion`.
2020-12-17 11:36:23 -08:00
Herb Sutter
b7548fd1cd Update multi_span
Revert changes in multi_span to avoid a merge conflict, since this file was deleted in a parallel PR
2020-12-17 10:35:34 -08:00
Herb Sutter
cbfd8cd734 Parameterize Expects1 and Ensures` by contract group
Allows independently controlling handling of different categories of bugs, such as bounds checks vs. null checks.
User-extensible: Companies can instantiate their own `contract_group` objects for their own categories of contract checks, including for distinguishing contract "levels" like `Normal` vs. `Audit` by just creating those two groups that can then be controlled independently or in combination.
2020-11-27 17:06:01 -08:00
Herb Sutter
c16e4ce59f Replace GSL_CONTRACT_CHECK with contract_group 2020-11-27 16:33:12 -08:00
Herb Sutter
b34dc221a1 Remove GSL_ASSUME (unused code)
This is not specified in the C++ Core Guidelines as part of GSL, so it should not be documented or supported with a GSL name. And since we don't use it in the GSL repo either, we should just remove it directly. For more about why assumptions are a dangerous blunt instrument, including that they actively eliminate contracts checks including GSL's `Expects` and `Ensures`, see [P2064](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2064r0.pdf).
2020-11-27 11:10:53 -08:00
Herb Sutter
c20a54c8e7 Remove __builtin_expect prediction assistance
In microbenchmarks I tried, using `__builtin_expect` to indicate which branch was likely/unlikely was never faster, and often slower, than just omitting. In GSL, this is used only for `Expects` and `Ensures` which are nearly always true, and all processors have long been great at predicting such branches well.
2020-11-27 11:07:55 -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
Jordan Maples
1665f07cf6 updating readme to reflect the deprecation of string_span 2020-10-01 14:38:41 -07:00
Jordan Maples
3f68a0034a fixed botched formatting 2020-10-01 14:16:01 -07:00
Jordan Maples
7721de88f3 ran clang-format over string_span 2020-10-01 14:08:01 -07:00
Jordan Maples
a64c489c78 added deprecation message 2020-10-01 14:04:04 -07:00
Jordan Maples
5e773556fe initial deprecation of all types in string_span 2020-09-30 16:39:33 -07:00
Jordan Maples [MSFT]
5de956aaf0
Merge pull request #929 from JordanMaples/yml_experiment
split GitHub action into multiple files.
2020-09-23 14:23:52 -07:00
Jordan Maples [MSFT]
bd803cc7cf
Merge pull request #928 from JordanMaples/narrowing_error-add-what
add what to narrowing_error
2020-09-14 16:51:38 -07:00
Jordan Maples
e7e3bf4f5f add what to narrowing_error 2020-09-14 15:50:46 -07:00
Jordan Maples [MSFT]
21b69e5cce
Updating span section of Supported Features table.
Added a link to the span section to point to the "gsl::span and std::span" page in the wiki.
2020-08-28 10:53:19 -07:00
Jordan Maples [MSFT]
d58e50c6f4
Merge pull request #922 from JordanMaples/constexpr-string_span
constexpr string_span
2020-08-27 14:29:30 -07:00