Commit Graph

312 Commits

Author SHA1 Message Date
Jordan Maples
8d907dadfb prevent comparison for apple clang versions older than 11 2020-04-09 14:35:44 -07:00
Jordan Maples
b7d9d754ac another attempt at apple clang version filtering 2020-04-09 14:17:52 -07:00
Jordan Maples
809aee2315 testing different major/minor for Apple suppression 2020-04-09 11:51:59 -07:00
Jordan Maples
6ef56d73da fixed a couple typos 2020-04-09 10:35:44 -07:00
Jordan Maples
2f9d873043 added additional filtering to Apple clang versions 9.4 and 10.1 for the ArrayConvertibilityCheck 2020-04-09 10:34:58 -07:00
Jordan Maples
f85166aa8b Merge branch 'master' into dev/jomaples/LWG3255 2020-04-09 09:53:45 -07:00
Farwaykorse
611674d60b
GCC "-Warray-bounds" warning persists with release 8.4
modification of commit 5e21831494
2020-04-09 03:50:17 +02:00
Jordan Maples
15dd17aa5b Merge branch 'master' into dev/jomaples/LWG3255 2020-04-08 14:47:08 -07:00
Jordan Maples
01d206f4d8 adding additional filtering 2020-04-08 14:38:01 -07:00
Roelf-Jilling
5e21831494 Suppress test for GCC 8.3 triggering "-Warray-bounds" 2020-03-26 20:15:29 +01:00
Roelf-Jilling
30c068781f Merge branch 'master' into TravisCI 2020-03-26 16:24:19 +01:00
Jordan Maples
ddde9e153d update convertibility test 2020-03-19 14:08:04 -07:00
Jordan Maples
6eab19d3c1 moving decl so we dont get the stl_nullptr is not used warning 2020-03-17 15:13:26 -07:00
Jordan Maples
f8bcb7d9eb applied clang-format 2020-03-17 15:04:58 -07:00
Jordan Maples
9b3ac8d681 discussed the issue with Casey Carter, the span ctor changes are accurate but the tests are not. The test require work that was done in C++17 regarding qualifier conversions to work correctly. Scoping tests for 17. 2020-03-17 15:02:00 -07:00
Jordan Maples
1dd1320c8b test commit to get extra eyes on the problem 2020-03-17 13:53:13 -07:00
Jordan Maples [MSFT]
c853017be3 forgot nl @ eof in span_ext_tests.cpp 2020-02-19 14:44:22 -08:00
Jordan Maples [MSFT]
94f43d4adf splitting up span's standard and non-standard behavior 2020-02-19 14:28:12 -08:00
Jordan Maples [MSFT]
f4c608fd39 addressing comments 2020-02-18 14:09:11 -08:00
Jordan Maples [MSFT]
8ba6cb1074 Merge branch 'dev/jomaples/unsigned' of https://github.com/jordanmaples/gsl into dev/jomaples/unsigned 2020-02-18 10:13:14 -08:00
Jordan Maples [MSFT]
8d6ca323fa GTest latest is breaking, rolling back to 1.10 until further investigation 2020-02-18 10:13:03 -08:00
Jordan Maples [MSFT]
6b01a0488b Update span_compatibility_tests.cpp
some fixes.
2020-02-14 16:25:25 -08:00
jordan maples
b6b1e9c3cf assert -> expect_true 2020-02-14 16:13:21 -08:00
Jordan Maples [MSFT]
67a7f7eaef errors in appveyor are indicating that AsWritableByesCompilersFor needs to be static. 2020-02-14 15:44:58 -08:00
Jordan Maples [MSFT]
41ae38f197 addressing a few more comments and adding gsl-std span compatibility tests 2020-02-14 15:24:46 -08:00
Jordan Maples [MSFT]
926aaeca56 reviewed the pr in its entirety and made some slight modifications. Removed all members and fields marked as deprecated. 2020-02-11 16:36:07 -08:00
Jordan Maples [MSFT]
d8fa68c4a5 address build failures 2020-02-07 14:40:09 -08:00
Jordan Maples [MSFT]
377b2db537 almost parity with std::span 2020-02-07 14:09:57 -08:00
Jordan Maples [MSFT]
a49ff1b8df update span specialization of at, change some tests back to int i with narrowing for the comparisons. 2020-02-05 17:12:31 -08:00
Jordan Maples [MSFT]
3b9d15f49f reverting changes to gsl::index 2020-02-05 17:02:23 -08:00
Jordan Maples [MSFT]
45f016d96f add back capture variable for comparison in span_test 2020-02-05 14:41:41 -08:00
Jordan Maples [MSFT]
7fcc142ffc addressing travis errors 2020-02-05 14:32:08 -08:00
Jordan Maples [MSFT]
432be4852c captureing result of iterator comparisons to address -Wunused-comparison 2020-02-05 13:59:48 -08:00
Jordan Maples [MSFT]
5cf1610cfe prevent overflow in size_bytes. fix compilation issue for clang 3.6 and 3.7 2020-02-05 12:58:49 -08:00
Jordan Maples [MSFT]
d7e1611137 gsl::index ptrdiff_t -> size_t. remove span::at span::operator(). 2020-02-04 16:53:43 -08:00
Jordan Maples [MSFT]
5a1e4f3953 update index_type to size_type, fix a couple Expects 2020-02-04 15:31:33 -08:00
Jordan Maples [MSFT]
eabd9358f0 addressing some comments 2020-02-03 12:46:37 -08:00
Jordan Maples [MSFT]
ad71477183 fix build breaks 2020-02-03 12:26:15 -08:00
Jordan Maples [MSFT]
c31593dd0d updating from test loop from int to size_t 2020-02-03 11:01:24 -08:00
Jordan Maples [MSFT]
8579165d0a change span from signed to unsigned to align to std 2020-02-03 10:56:31 -08:00
Jordan Maples [MSFT]
6b23937baf remove move constructor for not_null. 2020-01-30 17:00:13 -08:00
Jordan Maples [MSFT]
6e20bfbba2
Merge pull request #836 from Farwaykorse/suppressionToCMake
Compiler warning suppression for tests to CMake
2020-01-22 11:59:51 -08:00
Roelf-Jilling
95730a80c4 Restore disabling of exceptions for Microsoft STL in "no exception tests" 2020-01-16 19:31:31 +01:00
Roelf-Jilling
72312b6474 Revert "adding /EHsc for msvc cmake target gsl_test_config_noexcept"
This reverts commit 3539bd8008.
2020-01-16 19:29:36 +01:00
Roelf-Jilling
e1a37d0430 Suppress -Wundefined-func-template for C++17 Clang v5.0.x and AppleClang 9.1
Warning appears on v5.0.2 from apt.llvm.org and Ubuntu provided v5.0.1
2020-01-16 17:55:58 +01:00
Roelf-Jilling
81f56796a1 MSVC and CoreChecker warning suppression for tests to CMake
Suppress CppCoreCheck warnings on GTest macros.
Suppress CppCoreCheck advice to use the GSL
2020-01-16 11:49:15 +01:00
Roelf-Jilling
4cbd894812 Enable more warnings in GCC 2020-01-16 11:49:15 +01:00
Roelf-Jilling
d08ff53e61 Use [[maybe_unused]] with C++17 2020-01-16 11:49:15 +01:00
Roelf-Jilling
186f5d21c1 Move compiler warning suppression for tests from cpp files to CMake 2020-01-16 11:49:00 +01:00
Jordan Maples [MSFT]
395a5bf550
Merge branch 'master' into dev/jomaples/add_missing_span_functions 2020-01-10 10:20:37 -08:00
Jordan Maples [MSFT]
a1e6fcbc46
Merge branch 'master' into dev/jomaples/deprecate_span_non_std_functions 2020-01-09 16:39:24 -08:00
Jordan Maples [MSFT]
2d878b94ee
Merge branch 'master' into dev/jomaples/add_missing_span_functions 2020-01-09 16:37:12 -08:00
Jordan Maples [MSFT]
b076205338 Merge branch 'dev/jomaples/deprecate_span_non_std_functions' of https://github.com/JordanMaples/GSL into dev/jomaples/deprecate_span_non_std_functions 2020-01-09 14:40:08 -08:00
Jordan Maples [MSFT]
75936c3109 missed from the merge 2020-01-09 12:56:00 -08:00
Jordan Maples [MSFT]
cfd82aef4e deprecating span::at and span::operator() 2020-01-09 12:51:28 -08:00
Jordan Maples [MSFT]
4b823b1651 adding front and back 2020-01-09 12:03:27 -08:00
Martijn Otto
fa8a8117a0
Add tests for free-standing iterator and size functions 2020-01-08 21:02:02 +01:00
Jordan Maples [MSFT]
f04907c2f6 added suppression for missing destructor override 2020-01-08 10:13:00 -08:00
Jordan Maples [MSFT]
40bc3c3f00 testing something 2019-12-20 13:32:14 -08:00
Jordan Maples [MSFT]
8577033f13 addressing comments 2019-12-19 14:05:02 -08:00
Jordan Maples [MSFT]
3539bd8008 adding /EHsc for msvc cmake target gsl_test_config_noexcept 2019-12-13 13:56:42 -08:00
Jordan Maples [MSFT]
6c5c708877 change from string to char* 2019-12-12 16:48:59 -08:00
Jordan Maples [MSFT]
0931262acf appveyor failed to start, sending dummy commit 2019-12-12 14:39:12 -08:00
Jordan Maples [MSFT]
5099e8fa3e removed string_view for string in tests 2019-12-12 11:15:41 -08:00
Jordan Maples [MSFT]
4f6f05d463 changing text in notices & readme. adding terminate handler for tests 2019-12-12 10:55:26 -08:00
Jordan Maples [MSFT]
0784866608 added back death test, fixed VS2019 test failures 2019-12-09 16:08:27 -08:00
Jordan Maples
9a88262544 fixing suppression of gtest warnings for gcc 2019-12-06 16:03:47 -08:00
Jordan Maples [MSFT]
b39a9732f8 attempting to fix the gtest print issues in vs17 2019-12-04 13:46:50 -08:00
Jordan Maples [MSFT]
87eaa45445 suppressing -Wundef in clang (GTest emitted) 2019-12-04 12:48:13 -08:00
Jordan Maples [MSFT]
43aca2646b ignore warnings from gtest 2019-12-04 12:30:58 -08:00
Jordan Maples [MSFT]
603b4671c1 removing unused function 2019-12-03 15:24:52 -08:00
Jordan Maples [MSFT]
2b10729386 gtest migration 2019-12-03 14:32:25 -08:00
Jordan Maples [MSFT]
5e0d76a1a7 deprecating span::at and span::operator() 2019-11-19 14:31:21 -08:00
Jordan Maples [MSFT]
d0e5daf441 fix ctad warning in llvm 2019-11-15 12:11:44 -08:00
Jordan Maples [MSFT]
3d56ba9e7f
Merge pull request #813 from JordanMaples/dev/jomaples/deprecate_multispan
Deprecate multi_span, strided_span, etc
2019-10-09 15:11:59 -07:00
Jordan Maples
4b289d4cf0 lack of nl for bounds_test 2019-10-04 14:15:24 -07:00
Jordan Maples
6ff4a5287d accidentally commented out pragma 2019-10-04 14:13:54 -07:00
Jordan Maples
2b8f7aea32 adding clang/gcc suppression of the deprecation warnings. 2019-10-04 12:38:55 -07:00
Jordan Maples
eb995b3671 deprecating strided_span 2019-10-02 16:17:46 -07:00
Jordan Maples
bbeb0bdc91 initial deprecation of multi_span and strided_span 2019-09-28 12:54:18 -07:00
B1Z0N
d5382a293b Fixed memory leaks 2019-09-01 00:36:13 +03:00
B1Z0N
787e7ef616 Thanks to @stayprivates fixed out of bounds access in "TestNotNullostream" 2019-09-01 00:35:04 +03:00
Anna Gringauze
6418b5f4de
Clang cl (#762)
* Added c++17 test configurations for clang5.0 and clang6.0

* Fix #739 correct cppcorecheck warnings for clang-cl

* Add clang-cl  configurations

* Corrections Appveyor;
Temporarily disable msvc compilation for faster testing (#741)

* Add path to clang-cl.exe (#741)

* Escape backslash in path (#741)

* Update vcpkg (#741)

* Check vcpkg version; try without building vcpkg; use latest clang-cl from path (#741)

* Fix blocks in ps script (#741)

* Try accessing APPVEYOR_BUILD_FOLDER variable (#471)

* Update span size() bug confirmation test for GCC 6.5 (#741)

* MSVC flags to Clang-cl; disable c++98-compat and undefined macro warnings (#741)

* Suppress clang warning on tests (missing-prototypes) (#741)

* Fix clang warning -Wnewline-eof (#741)

* Fix clang warning -Wdouble-promotion (#741)

* Set linker explicitly

* Clean condition statement

* For Clang, fallback to the AppVeyor installed version of CMake

* Fix clang warning -Wmissing-variable-declarations

* Fallback to the MSVC linker until vcpkg has been updated

* Revert "Fallback to the MSVC linker until vcpkg has been updated"

This reverts commit 7263f3289e.

* Fix clang warning -Wunused-member-function

* Fix clang warning -Wmissing-noreturn

* Fix clang warning -Winvalid-noreturn on Windows

* Add macro block end comment on large #if blocks

* Workaround: fallback to mscv link.exe

* Workaround: get msvc paths into PowerShell through intermediate file

* Workaround: fix, remove "PATH=" from text

* Workaround: try with full-path; and return user PATH

* Workaround: fix, escape backslashes

* Revert all since "Workaround: fallback to mscv link.exe" did not work on AppVeyor

This reverts the commits:
bda3d6a428
97062933ac
0f4fb04bac
1b0c19afd1
a5739ea5f0

* Suppress output of git pull; remove vcpkg from cache

* Re-enable AppVeyor builds for all platforms

* Correct typo

Co-Authored-By: Farwaykorse <Farwaykorse@users.noreply.github.com>

* Add Clang-cl 7.0.0 to the supported platforms

* Revert "Fix clang warning -Wunused-member-function"

This reverts commit 6fe1a42035.

* Fix or locally suppress clang warning -Wunused-member-function

* format touched code and correct comment

* git pull --quiet

* fix logic error in workaround

* fix missing bracket

* Suppress output of mkdir

* Replace MSBuild with Ninja

* Suppress output of 7z

* Add architecture flags for Clang

* Drop workaround for lld-link

* 7-zip Overwrite and Alternative output suppression without suppressing errors

Replaces 3c1c0794dd

* AppVeyor setup and CMake before build

* reorder compiler configuration

* remove unnecessary

* remove -fno-strict-aliasing

* remove -Wsign-conversion, since before v4.0 part of -Wconversion

* -Wctor-dtor-privacy is GCC only

* remove -Woverloaded-virtual part of -Wmost, part of -Wall

* add -Wmissing-noreturn

* remove the pragmas for -Wunused-member-function

* Re-add MSBuild generator on AppVeyor

* Print CMake commands

* Add MSBuild toolset selection

* Separate Architecture setting

* clang-cl: add -Weverything

* clang-cl -Wno-c++98-compat

* clang-cl -Wno-c++98-compat-pedantic

* clang-cl -Wno-missing-prototypes

* clang-cl C++14 -Wno-unused-member-function

* clang-cl -Wundef __GNUC__

* clang++: add -Weverything

* clang++ -Wno-c++98-compat

* clang++ -Wno-c++98-compat-pedantic

* clang++ -Wno-missing-prototypes

* clang++ -Wno-weak-vtables

* clang++ C++14 -Wno-unused-member-function

* clang++ fix -Wundef _MSC_VER

* clang++ -Wno-padded

* clang++ solve -Wdeprecated

* Add AppleClang compiler target
Since CMake v3.0 use of Clang for both is deprecated

* clang++ v5.0 C++17 -Wno-undefined-func-template

* Add VS2015 + LLVM/clang-cl to AppVeyor

* Do not disable constexpr when compiling with clang-cl on Windows

* Clean-up clang-only warnings (now under -Weverything)

* Revert "Fix clang warning -Winvalid-noreturn on Windows"

This reverts commit 2238c4760e.

* Suppress -Winvalid-noreturn for the MS STL noexception workaround

* CMake: put preprocessor definition in target_compile_definitions

* Solve compiler warning C4668: __GNUC__ not defined
2019-01-15 10:27:34 -08:00
Johel Ernesto Guerrero Peña
6eeed739f1 Make narrow constexpr (#698) 2019-01-14 18:37:37 -08:00
Anna Gringauze
9ff6e19ea9
Dev/annagrin/remove explicit not null constructor (#743)
* Added c++17 test configurations for clang5.0 and clang6.0

* Removed explicit not_null constructor, sloppy_not_null, added strict_not_null

We added explicit not_null constructor in version 2.0.0.
It proved very difficult to switch to the new version for
large code bases that adopted previous versions of gsl,
due to not_null used extensively in the code. Still, using
explicit constructor is very benefitial for new code, since
it encorages better API design and make null checks intentional.

To resolve the issue, this change:
- removes explicit keyword from not_null constructor
- removes unneded sloppy_not_null type
- adds strict_not_null type to behave the same way as v2 not_null
- updates tests

* Removed explicit not_null constructor, sloppy_not_null, added strict_not_null

We added explicit not_null constructor in version 2.0.0.
It proved very difficult to switch to the new version for
large code bases that adopted previous versions of gsl,
due to not_null used extensively in the code. Still, using
explicit constructor is very benefitial for new code, since
it encorages better API design and make null checks intentional.

To resolve the issue, this change:
- removes explicit keyword from not_null constructor
- removes unneded sloppy_not_null type
- adds strict_not_null type to behave the same way as v2 not_null
- updates tests

* fixed build break for gcc7

* added more tests

* added more non-compiling tests

* Addressed PR comments and suppressed a code analysis warning

* Fixed test failure in not_null tests
2019-01-14 16:45:47 -08:00
Anna Gringauze
b673375719
Dev/annagrin/fix span size test gcc (#750)
* Added c++17 test configurations for clang5.0 and clang6.0

* fixed test for broken span.size() in gcc6.5
2018-11-27 17:28:57 -08:00
Dave Hill
c02ddae4bc Span can be constructed from empty std::array safely (#686)
* Span std::array c'tor uses arr.data() instead of &arr[0]
- Fixes runtime issues when constructing from an empty std::array

* Construct span with std::data if C++17 detected

* Specialize span c'tor for std::array of length 0, set storage to nullptr
2018-11-05 15:39:41 -08:00
Anna Gringauze
1995e86d1a span constructor no address (#723)
* Changed &arr[0] to std::array<T, N>::data and std::address_of to protect against overloaded operator&.

* Removed the usage of `std::addressof` because it is a C++ 17 feature. Using decay for C arrays instead.

* Add unit tests for #662.

* Added c++17 test configurations for clang5.0 and clang6.0

* fixed CppCoreCheck pointer decay warning
2018-08-19 17:10:53 -07:00
Stephan Dollberg
86be2366c7 Fix #717 - Add empty() to strided_span (#718) 2018-08-17 11:47:03 -07:00
Anna Gringauze
6241b3faa6
Dev/annagrin/sloppy not null (#712)
* Added c++17 test configurations for clang5.0 and clang6.0

* added transition helper sloppy_not_null

* Moved gsl_transition to a samples folder

* Fixed build break and static analysis warnings
2018-08-13 09:55:48 -07:00
Anna Gringauze
831584d947
Dev/annagrin/make not null (#711)
* Added c++17 test configurations for clang5.0 and clang6.0

* Added make_not_null helper to create a not_null

Introduction of explicit not_null constructor made it cumbersome to create not_nulls
in c++14. Adding make_not_null helper. Usage (see tests):

int i = 42;

auto x = make_not_null(&i);
helper(make_not_null(&i));
helper_const(make_not_null(&i));

* Added std::forward to make_not_null, fixed some code analysis warnings

* Fix build break in VS2015 Release configuration

* Fix build break in VS2015 Release configuration
2018-08-13 02:22:02 -07:00
Anna Gringauze
cea0d0ac2b fix cppcorecheck warnings (#703)
* Added c++17 test configurations for clang5.0 and clang6.0

* Fixed CppCoreCheck warnings in GSL and tests

- Added CMakeSettings.json for VS Open Folder configuration
	- So we can easily run CppCoreCheck in VS
- Fixed CppCorecheck warnings where it made sense
- Suppressed the rest
	- Some suppression does not work due to compiler/tool bugs,
          so replaced by #pragma disable
	- CppCoreCheck has noise, suppressed those with comments
	- Catch produces many warnings, blanket-supressed them all
- Had to fix clang formatting to keep attributes in place
	- clang-format does not support attributes, so I am using
        - "CommentPragmas: '^ NO-FORMAT:'" to skip formatiting on them
- Removed GSL_NOEXCEPT macro, removed incorred noexcepts

* Ignore unknown attributes

* ignore unknown attributes in noexception mode tests

* fixed C26472 in at()

* created GSL_SUPPRESS macro to allow all compilers to parse suppression attributes

* try to fix gcc compilation problems with attributes

* ignore gsl::suppress for gcc

* move suppression to function level on return statements

clang5.0 and up does not allow attributes on return statemets in constexpr functions

* move suppression to function level on return statements

* use GSL_SUPPRESS in algorithm_tests

* Addressed PR comments
2018-08-12 21:44:17 -07:00
Daniel599
5778149583 Test broken size (#704)
* added test for size check (#590)

* added #if for gcc 6.4 bug (#590)

* hopefully fix #if for gcc 6.4 bug (#590)

* fixed CHECK usage (#590)

* gcc broken size bug is only when using optimizations
2018-07-13 17:19:09 -07:00
Anna Gringauze
21cb6bb8b0
Added testing for c++17 to latest compilers with test with (#692)
* Added testing with std=c++17 for latest compilers

Added running latest compilers with -std=c++17 option to CI the test matrix,
Updated cmake configuration to allow passing c++ standard on the command line.

* attempt to fix appveyor break

* added clang6.0, removed c++17 tests for clang 5.0

* commented out tests for clang with c++17 die to issue #695

* Addresed comments
2018-06-15 10:13:11 -07:00
Anna Gringauze
cb2d1af89a
Added template argument deduction for not_null (#689)
* Added template  argument deduction for not_null

This allows compilers with c++17 support to infer template
instantiation types when calling not_null constructor:

    int foo(not_null<const int*> x);

    int main()
    {
        int t = 0;
        not_null x{ &t };
        return foo(not_null{ &t });
    }

* replaced deduction guides by a simple constructor

* Updated tests

* fixed check for availability of std::byte

* testing c++1z on clang

* fixed cmakelists extra endif

* include cstddef header for clang and gcc in pointers

* fixed a typo

* fix missing nullptr_t type

* fixed typo in CMakeLists.tst

* change approach to c++17 testing, step one: revert cmake testing, update clang5.0 package

removed using latest c++ due to clang5.0 failing,
update clang5.0 travis config to use llvm-toolchain-trusty-5.0

* addressed comments
2018-06-07 13:36:56 -07:00
beinhaerter
75ad0c1b40 Add as_bytes for basic_string_span, fixes issue #655 (#683) 2018-05-28 19:03:10 -07:00
ericLemanissier
2fc94db3eb not_null constructor is now explicit (#659)
solves #395
2018-04-24 19:11:43 -07:00
Anna Gringauze
d846fe50a3
Enable usage of gsl::narrow with exceptions disabled (#640)
* Enable usage of gsl::narrow with exceptions disabled

This solution uses the approach of boost::asio to enabling usage of the
library in environments where exception usage is either prohibited
or not feasible (due to code size constraints). A function template
gsl::throw_exception has been added, which in a normal environment just
throws the exception. However, when GSL_TERMINATE_ON_CONTRACT_VIOLATION
is defined the function is only declared by gsl and the definition of
this function template must be supplied by the library's user.

Closes: #468

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>

Addition:
- understand STL no exception macro
- use function static variable to set termination handler in kernel mode
- add compile-only tests for no-exception mode

* added termination tests and fixed bugs

* disabled warning C4577 for msvc 2015
2018-03-15 16:00:08 -07:00
Neil MacIntosh
6a33b97a84
Fix return type of templated span.subspan() (#625)
* Added support for returning fixed-spize spans from subspan().

* Addressed issues from code review.

* Took simpler approach to static data member.

* Subtle fix to support MSVC 15.

* Helps to not introduce extraneous >
2018-03-03 19:12:45 -08:00
Zac Hansen
ed3693fd2e make explicit not_null move constructor so it is noexcept (#630)
* make explicit not_null move constructor so it is noexcept

* added test for not_null being noexcet move constructible
2018-03-03 15:53:23 -08:00