* 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
* 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
* 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
* 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
* 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
* 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 >
* Made string_span details::string_length() generic
removed overloads & specialized classes
Creating string_spans using `char16_t` and `char32_t` was not possible
without creating new specializations and function overloads.
This patch makes details::string_length() generic removing the need to
extend the overloads and specializations.
* added type aliases for string_span types char16_t and char32_t
* Added char16_t & char32_t overloads for ensure_z
* added string_span tests for char16_T & char32_t
* added zstring type aliases for char16_t & char32_t
* Added tests for char16_t & char31_t zstring and string_span types
* applies clang format to <gsl/string_span>
* Clang format tests/string_span_tests.cpp
* Removed ensure_z() overloads as they don't add functionality.
Catch was being installed to the root of the cmake project. This
violated the source code tree itself and would not work at all if GSL
was being consumed with add_subdirectory.
CMake will now install catch to the build tree under /dependencies.
* Fixes issue with dereferencing operator issue #491 introduced in PR #513
dereferencing operator added in PR#513 returned a copy of the object
instead of reference to it.
Adding decltype(auto) as return type of operator* fixes this issue.
* added more tests for not_null::operator*
* Restricting usage of owner<T> to pointer types
* Removing an additional type that was created for testing
* Added comment about the new constraint on owner
* Adding dereference operator to not_null
* Removing dereference operator changes for not-null
* Removing dereference operator changes for not-null
* Review comments
* Refactor cmake file to have GSL as an interface
CMake supports header only libraries as INTERFACE libraries. Using
interfaces libraries make is easier for users to use the library because
one just need to "link" agaisnt the library and necessary include paths,
definitions, flags... will be taken care of.
This commit creates a new interface library called GSL. It then add the
following things to the GSL library:
- compiler flags ex: (-std=c++14)
- definitions ex: _SCL_SECURE_NO_WARNINGS
- include paths ex: include/gsl
- natvis file
Another project can now have the GSL project as a git submodule and one
only need to add the two following lines to their project to use the
GSL.
add_subdirectory(GSL)
target_link_libraries(<some target> GSL)
After cmake 3.8.0 a lot of the logic can be simplified. Right now the
cmake file has an if for version checking, but when the minimun required
version is 3.8.0 one can just delete the branching and keep the simpler
version.
* Cut support for c++11
Compiling on GCC6.2 with only the c++11 flag will generate compilation
errors. For example some of the errors are related to the use of
enable_if_t which is a c++14 feature.
To avoid compilation errors this comiit removes c++11 support on linux.
* Refactor code that pulls unittest-cpp
Two minor changes:
- uses cmake to find a proper installation of git (in case user does not
have it on the path)
- checks for the CMakeLists file instead. This is needed for the build
itself and seems like a better way to do the checking
* Refactor tests so they show together on VS
This commit will make a VS geenrated project to group all tests under
GSL_tests
* Refactor tests configuration
This creates a test configuration interface and add all the previous
compiler options to that interface. compiler options are now sorted so
it is easier to find them, and also one per line, so that modifications
are easier to track from git.
Project files were not following the clang-format style. For people
using IDEs were clang-format is always run after a save this would
cause unwanted changes.
This commit only applies "clang-format -i" to files.
* Added support of not_null<smart_ptr> comparison
* The return type of not_null comparison operators is determined using SFINAE
#474
* tests for gsl::not_null comparison were added
* not_null comparison tests were rewritten to compare pointers to objects located in the same array
* not_null<shared_ptr> comparison was simplified
* initializer_list overload returns by value to avoid lifetime issues
* generic overload uses expression SFINAE to work with any type that has member size() and operator[], which notably includes const/non-const vector and array.
* Add test coverage for const objects, rvalue initializer_lists, and constexpr usage.
Fixes#357.
* Improve const correctness in string_span
* Improve const correctness in bounds_tests.cpp and byte_tests.cpp
* Improve const correctness in span_tests.cpp
* Improve const correctness in utils_tests.cpp
* Use gsl::owner for dynamically allocated memory in string_span_tests.cpp
* Improve const correctness in string_span_tests.cpp
* Improve const correctness for strided_span_tests.cpp
Now that the STL respects /W4, this test that uses std::copy_n to copy a span of ints to a span of chars triggers "warning C4244: '=': conversion from 'int' to 'char', possible loss of data". Switch the source & destination spans to short and int to maintain the test's cross-type nature but without narrowing.
* Nest "gsl" directory inside a new "include" directory.
* Cleanup the _MSC_VER conditionals a bit; use constexpr on VS2017+.
* Don't #define noexcept on non-Microsoft implementations.
* Workaround VS2017 bug in multi_span. (Also implement == and != for static_bounds_dynamic_range_t because I'm an EoP semantic soundness snob.)
Fixes#441.
This patch provides a make_span function to simplify the
creation of spans until C++17 is available. In addition
this patch updates the unit tests to includes tests that
verify this new functionality.
This patch adds support for std::unique_ptr and
std::shared_ptr to the gsl::span
class instead of having to manually grab the pointer via
get().
For reference, this is part of the following issue:
https://github.com/Microsoft/GSL/issues/402
When turning on the following flags, several additional warnings
were generated, which have been cleaned up in this patch. The
flags included:
-Wextra
-Wpedantic
-Wconversion
-Wsign-conversion
-Wctor-dtor-privacy
-Wshadow
-Wnon-virtual-dtor
-Wold-style-cast
-Wcast-align
-Woverloaded-virtual