Commit Graph

78 Commits

Author SHA1 Message Date
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]
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
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]
8577033f13 addressing comments 2019-12-19 14:05:02 -08:00
Jordan Maples [MSFT]
6c5c708877 change from string to char* 2019-12-12 16:48:59 -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]
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
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
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
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
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
Neil MacIntosh
2bdbba7418 Removed span from-nullptr_t ctor. 2018-02-10 19:21:22 -08:00
Neil MacIntosh
72688ff009 Removed span.length() as synonym for span.size(). 2018-02-10 18:58:28 -08:00
Neil MacIntosh
028925caba Removed from-smart-ptr constructors. 2018-02-10 18:05:17 -08:00
Tiago
0d33bf6794 Applied iwyu --comment to the code base (#588) 2017-11-28 07:13:49 -08:00
menete
1d936eb90c additional span tests (pointer length constructor) (#568) 2017-10-31 10:11:45 -07:00
Neil MacIntosh
b2ee484334 Move from unittest-cpp to catch for unit testing. (#533)
Many thanks to @rianquinn. This should fix #495, #494 and #529.
2017-07-13 13:53:56 -07:00
Tiago
ebe7ebfd85 Reformat files to follow clang-format style (#492)
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.
2017-04-20 07:51:37 -07:00
MikeGitb
ade86caa92 Fix some corechecker warnings (#470)
* 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
2017-04-02 12:30:49 -07:00
Casey Carter
96eaf274f8 Make is_default_constructible work for spans. 2017-01-28 00:08:48 -08:00
Rian Quinn
2df9f85385 Add make_span()
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.
2016-11-16 10:17:04 -08:00
Rian Quinn
bdcef948a5 Cleanup compiler warnings
The unique_ptr / shared_ptr patch introduced a compiler
warning. This corrects that issue.
2016-11-16 09:42:46 -08:00
Rian Quinn
2b51b8767a Add span construction from unique_ptr and shared_ptr
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
2016-11-03 18:55:41 -07:00
Rian Quinn
d641796b21 Cleanup additional GCC warnings
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
2016-11-03 18:38:32 -07:00
Rian Quinn
6cffe0d14c Adds gsl::span::at()
As per this discussion:
https://github.com/Microsoft/GSL/issues/402

This patch adds support for at() to gsl::span
2016-10-26 14:11:24 -07:00
Neil MacIntosh
3b2419532e Corrected SFINAE for conversion constructors on span. 2016-09-12 18:51:23 -07:00
ericLemanissier
134f2db5d9 Specialize gsl::at for span
span being a view and not a container, the generic version of gsl::at is not valid any more for span.
This commits adds a specialization of gsl::at for span
2016-08-23 12:18:36 +02:00
Neil MacIntosh
f3e660a5a5 Added basic test for interop with std::regex as per Issue #271. 2016-08-10 19:39:48 -07:00
Neil MacIntosh
d6ac640271 Added basic test for interop with std::regex as per Issue #271. 2016-08-10 19:32:00 -07:00
Neil MacIntosh
6b4ae834a3 Merge branch 'master' into dev/neilmac/iterators 2016-08-10 19:00:43 -07:00
Galik
222c2d85fd Removed .h extension from header files. 2016-08-10 17:24:00 +01:00
galik
f6cc5798a1 Renamed include/ folder to gsl/ to make including the library consistent
whether using it from the development folder, from the installation
folder or from being copied into a project. 

    #include <gsl/gsl.h>

Updated headers/tests/instructions/cmake build accordingly

This PR should address https://github.com/Microsoft/GSL/issues/277 (less
the renaming of gsl itself)
2016-08-09 15:04:58 +01:00
Neil MacIntosh
32ee66d320 Added basic tests for std::begin/end and friends (Issue #252). 2016-08-08 13:48:12 -07:00
Neil MacIntosh
0dd5f56bed Fixed unused variable and ran clang-format. Tested on gcc/clang. 2016-08-08 13:33:02 -07:00
Neil MacIntosh
82389aa630 Fixed up iterator implementation to allow conversion from iterator to
const_iterator.
2016-08-08 12:06:47 -07:00
Neil MacIntosh
8e31f53f8a Building clean with MSVC12. 2016-07-29 11:16:06 -07:00
Neil MacIntosh
ca4cdd80de 64-bit clean fixes. 2016-07-20 12:47:21 -07:00