From 5e0d76a1a70fbbc961b2dcebef64fefd686583de Mon Sep 17 00:00:00 2001 From: "Jordan Maples [MSFT]" <49793787+JordanMaples@users.noreply.github.com> Date: Tue, 19 Nov 2019 14:31:21 -0800 Subject: [PATCH 1/3] deprecating span::at and span::operator() --- include/gsl/span | 4 ++++ tests/span_tests.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/include/gsl/span b/include/gsl/span index 59bd121..72b015f 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -510,8 +510,12 @@ public: return data()[idx]; } + // at and operator() are deprecated to align to the public member functions of std::span + [[deprecated("Use operator[]")]] constexpr reference at(index_type idx) const { return this->operator[](idx); } + [[deprecated("Use operator[]")]] constexpr reference operator()(index_type idx) const { return this->operator[](idx); } + constexpr pointer data() const noexcept { return storage_.data(); } // [span.iter], span iterator support diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index d22dc08..6ef9b93 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -18,7 +18,12 @@ // blanket turn off warnings from CppCoreCheck from catch // so people aren't annoyed by them when running the tool. #pragma warning(disable : 26440 26426 26497) // from catch +#pragma warning(disable : 4996) +#endif +#if __clang__ || __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif #include // for AssertionHandler, StringRef, CHECK, TEST_... @@ -1562,3 +1567,6 @@ TEST_CASE("default_constructible") CHECK((!std::is_default_constructible>::value)); } +#if __clang__ || __GNUC__ +#pragma GCC diagnostic pop +#endif From cfd82aef4e5084608f81fcf98908348778e8baa6 Mon Sep 17 00:00:00 2001 From: "Jordan Maples [MSFT]" <49793787+JordanMaples@users.noreply.github.com> Date: Tue, 19 Nov 2019 14:31:21 -0800 Subject: [PATCH 2/3] deprecating span::at and span::operator() --- include/gsl/span | 4 ++++ tests/span_tests.cpp | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/gsl/span b/include/gsl/span index 59bd121..72b015f 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -510,8 +510,12 @@ public: return data()[idx]; } + // at and operator() are deprecated to align to the public member functions of std::span + [[deprecated("Use operator[]")]] constexpr reference at(index_type idx) const { return this->operator[](idx); } + [[deprecated("Use operator[]")]] constexpr reference operator()(index_type idx) const { return this->operator[](idx); } + constexpr pointer data() const noexcept { return storage_.data(); } // [span.iter], span iterator support diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index edbd118..b047a4e 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -17,8 +17,11 @@ #ifdef _MSC_VER // blanket turn off warnings from CppCoreCheck from catch // so people aren't annoyed by them when running the tool. -#pragma warning(disable : 26440 26426 26497 4189) // from catch +#pragma warning(disable : 26440 26426 26497 4189 4996) +#if __clang__ || __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif #if __clang__ || __GNUC__ From 75936c310996d7bf7df2a5a9d97cbab4bdc1547e Mon Sep 17 00:00:00 2001 From: "Jordan Maples [MSFT]" <49793787+JordanMaples@users.noreply.github.com> Date: Thu, 9 Jan 2020 12:56:00 -0800 Subject: [PATCH 3/3] missed from the merge --- tests/span_tests.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index b047a4e..542e2e0 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -18,17 +18,14 @@ // blanket turn off warnings from CppCoreCheck from catch // so people aren't annoyed by them when running the tool. #pragma warning(disable : 26440 26426 26497 4189 4996) - -#if __clang__ || __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif +#endif #if __clang__ || __GNUC__ //disable warnings from gtest #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wundef" #pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif // __clang__ || __GNUC__ #if __clang__