mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
addressing comments
This commit is contained in:
parent
3539bd8008
commit
8577033f13
@ -24,21 +24,23 @@
|
||||
// disable warnings from gtest
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
||||
#if __clang__
|
||||
#pragma GCC diagnostic ignored "-Wglobal-constructors"
|
||||
#pragma GCC diagnostic ignored "-Wused-but-marked-unused"
|
||||
#pragma GCC diagnostic ignored "-Wcovered-switch-default"
|
||||
#endif
|
||||
#include <gtest/gtest.h>
|
||||
#endif // __clang__
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <gsl/gsl_algorithm> // for copy
|
||||
#include <gsl/span> // for span
|
||||
#include <array> // for array
|
||||
#include <cstddef> // for size_t
|
||||
|
||||
namespace{
|
||||
static const char *deathstring("Expected Death");
|
||||
namespace
|
||||
{
|
||||
static constexpr char deathstring[] = "Expected Death";
|
||||
}
|
||||
|
||||
namespace gsl
|
||||
@ -244,4 +246,4 @@ TEST(algorithm_tests, small_destination_span)
|
||||
|
||||
#if __clang__ || __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
@ -24,12 +24,13 @@
|
||||
//disable warnings from gtest
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
||||
#if __clang__
|
||||
#pragma GCC diagnostic ignored "-Wglobal-constructors"
|
||||
#pragma GCC diagnostic ignored "-Wused-but-marked-unused"
|
||||
#pragma GCC diagnostic ignored "-Wcovered-switch-default"
|
||||
#endif
|
||||
#endif // __clang__
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <gsl/gsl_assert> // for fail_fast (ptr only), Ensures, Expects
|
||||
@ -38,6 +39,8 @@ using namespace gsl;
|
||||
|
||||
namespace
|
||||
{
|
||||
static constexpr char deathstring[] = "Expected Death";
|
||||
|
||||
int f(int i)
|
||||
{
|
||||
Expects(i > 0 && i < 10);
|
||||
@ -50,8 +53,6 @@ int g(int i)
|
||||
Ensures(i > 0 && i < 10);
|
||||
return i;
|
||||
}
|
||||
|
||||
static const char *deathstring("Expected Death");
|
||||
} // namespace
|
||||
|
||||
TEST(assertion_tests, expects)
|
||||
@ -79,4 +80,4 @@ TEST(assertion_tests, ensures)
|
||||
|
||||
#if __clang__ || __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
@ -24,12 +24,13 @@
|
||||
//disable warnings from gtest
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
||||
#if __clang__
|
||||
#pragma GCC diagnostic ignored "-Wglobal-constructors"
|
||||
#pragma GCC diagnostic ignored "-Wused-but-marked-unused"
|
||||
#pragma GCC diagnostic ignored "-Wcovered-switch-default"
|
||||
#endif
|
||||
#endif // __clang__
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@ -40,8 +41,9 @@
|
||||
#include <initializer_list> // for initializer_list
|
||||
#include <vector> // for vector
|
||||
|
||||
namespace{
|
||||
static const char *deathstring("Expected Death");
|
||||
namespace
|
||||
{
|
||||
static constexpr char deathstring[] = "Expected Death";
|
||||
}
|
||||
|
||||
TEST(at_tests, static_array)
|
||||
@ -152,4 +154,4 @@ static_assert(test_constexpr(), "FAIL");
|
||||
|
||||
#if __clang__ || __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
@ -27,12 +27,13 @@
|
||||
|
||||
//disable warnings from gtest
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
||||
#if __clang__
|
||||
#pragma GCC diagnostic ignored "-Wglobal-constructors"
|
||||
#pragma GCC diagnostic ignored "-Wused-but-marked-unused"
|
||||
#pragma GCC diagnostic ignored "-Wcovered-switch-default"
|
||||
#endif
|
||||
#endif // __clang__
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@ -40,10 +41,6 @@
|
||||
|
||||
#include <cstddef> // for ptrdiff_t, size_t
|
||||
|
||||
namespace gsl {
|
||||
struct fail_fast;
|
||||
} // namespace gsl
|
||||
|
||||
using namespace std;
|
||||
using namespace gsl;
|
||||
|
||||
@ -127,4 +124,4 @@ copy(src_span_static, dst_span_static);
|
||||
|
||||
#if __clang__ || __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
@ -17,19 +17,20 @@
|
||||
#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) // from catch
|
||||
#endif
|
||||
#pragma warning(disable : 26440 26426)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if __clang__ || __GNUC__
|
||||
//disable warnings from gtest
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
||||
#if __clang__
|
||||
#pragma GCC diagnostic ignored "-Wglobal-constructors"
|
||||
#pragma GCC diagnostic ignored "-Wused-but-marked-unused"
|
||||
#pragma GCC diagnostic ignored "-Wcovered-switch-default"
|
||||
#endif
|
||||
#endif // __clang__
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@ -147,4 +148,4 @@ copy(src_span_static, dst_span_static);
|
||||
|
||||
#if __clang__ || __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
@ -28,13 +28,13 @@
|
||||
|
||||
//disable warnings from gtest
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
||||
#if __clang__
|
||||
#pragma GCC diagnostic ignored "-Wglobal-constructors"
|
||||
#pragma GCC diagnostic ignored "-Wused-but-marked-unused"
|
||||
#pragma GCC diagnostic ignored "-Wcovered-switch-default"
|
||||
|
||||
#endif
|
||||
#endif // __clang__
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@ -61,6 +61,7 @@ using namespace gsl;
|
||||
|
||||
namespace
|
||||
{
|
||||
static constexpr char deathstring[] = "Expected Death";
|
||||
struct BaseClass
|
||||
{
|
||||
};
|
||||
@ -139,7 +140,6 @@ void fn(const Bounds&)
|
||||
static_assert(Bounds::static_size == 60, "static bounds is wrong size");
|
||||
}
|
||||
|
||||
static const char *deathstring("Expected Death");
|
||||
} // namespace
|
||||
|
||||
TEST(multi_span_test, default_constructor)
|
||||
@ -1886,4 +1886,4 @@ copy(src_span_static, dst_span_static);
|
||||
|
||||
#if __clang__ || __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
@ -27,12 +27,13 @@
|
||||
//disable warnings from gtest
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
||||
#if __clang__
|
||||
#pragma GCC diagnostic ignored "-Wglobal-constructors"
|
||||
#pragma GCC diagnostic ignored "-Wused-but-marked-unused"
|
||||
#pragma GCC diagnostic ignored "-Wcovered-switch-default"
|
||||
#endif
|
||||
#endif // __clang__
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@ -52,9 +53,9 @@ struct fail_fast;
|
||||
|
||||
using namespace gsl;
|
||||
|
||||
namespace{
|
||||
static const char *deathstring("Expected Death");
|
||||
}
|
||||
namespace
|
||||
{
|
||||
static constexpr char deathstring[] = "Expected Death";
|
||||
|
||||
struct MyBase
|
||||
{
|
||||
@ -148,7 +149,7 @@ GSL_SUPPRESS(f.4) // NO-FORMAT: attribute
|
||||
bool helper_const(not_null<const int*> p) { return *p == 12; }
|
||||
|
||||
int* return_pointer() { return nullptr; }
|
||||
const int* return_pointer_const() { return nullptr; }
|
||||
} //namespace
|
||||
|
||||
TEST(notnull_tests, TestNotNullConstructors)
|
||||
{
|
||||
@ -564,4 +565,4 @@ static_assert(std::is_nothrow_move_constructible<not_null<void*>>::value,
|
||||
|
||||
#if __clang__ || __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
@ -25,12 +25,13 @@
|
||||
//disable warnings from gtest
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
||||
#if __clang__
|
||||
#pragma GCC diagnostic ignored "-Wglobal-constructors"
|
||||
#pragma GCC diagnostic ignored "-Wused-but-marked-unused"
|
||||
#pragma GCC diagnostic ignored "-Wcovered-switch-default"
|
||||
#endif
|
||||
#endif // __clang__
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@ -62,4 +63,4 @@ TEST(owner_tests, check_pointer_constraint)
|
||||
|
||||
#if __clang__ || __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
@ -26,17 +26,19 @@
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
||||
#if __clang__
|
||||
#pragma GCC diagnostic ignored "-Wglobal-constructors"
|
||||
#pragma GCC diagnostic ignored "-Wused-but-marked-unused"
|
||||
#pragma GCC diagnostic ignored "-Wcovered-switch-default"
|
||||
#endif
|
||||
#endif // __clang__
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <gsl/gsl_byte> // for byte
|
||||
#include <gsl/gsl_util> // for narrow_cast, at
|
||||
#include <gsl/span> // for span, span_iterator, operator==, operator!=
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <array> // for array
|
||||
#include <iostream> // for ptrdiff_t
|
||||
@ -58,6 +60,8 @@ using namespace gsl;
|
||||
|
||||
namespace
|
||||
{
|
||||
static constexpr char deathstring[] = "Expected Death";
|
||||
|
||||
struct BaseClass
|
||||
{
|
||||
};
|
||||
@ -75,7 +79,6 @@ struct AddressOverloaded
|
||||
return {};
|
||||
}
|
||||
};
|
||||
static const char *deathstring("Expected Death");
|
||||
} // namespace
|
||||
|
||||
TEST(span_test, constructors)
|
||||
@ -1642,4 +1645,4 @@ TEST(span_test, from_array_constructor)
|
||||
|
||||
#if __clang__ || __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
@ -27,12 +27,13 @@
|
||||
//disable warnings from gtest
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
||||
#if __clang__
|
||||
#pragma GCC diagnostic ignored "-Wglobal-constructors"
|
||||
#pragma GCC diagnostic ignored "-Wused-but-marked-unused"
|
||||
#pragma GCC diagnostic ignored "-Wcovered-switch-default"
|
||||
#endif
|
||||
#endif // __clang__
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <gsl/pointers> // for not_null, operator<, operator<=, operator>
|
||||
@ -143,7 +144,10 @@ TEST(strict_notnull_tests, TestStrictNotNull)
|
||||
}
|
||||
|
||||
#if defined(__cplusplus) && (__cplusplus >= 201703L)
|
||||
static const char *deathstring("Expected Death");
|
||||
namespace
|
||||
{
|
||||
static constexpr char deathstring[] = "Expected Death";
|
||||
}
|
||||
|
||||
TEST(strict_notnull_tests, TestStrictNotNullConstructorTypeDeduction)
|
||||
{
|
||||
@ -211,4 +215,4 @@ static_assert(std::is_nothrow_move_constructible<strict_not_null<void*>>::value,
|
||||
|
||||
#if __clang__ || __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
@ -25,18 +25,17 @@
|
||||
#if __clang__ || __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
//disable warnings from gtest
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
||||
#if __clang__
|
||||
#pragma GCC diagnostic ignored "-Wglobal-constructors"
|
||||
#pragma GCC diagnostic ignored "-Wused-but-marked-unused"
|
||||
#pragma GCC diagnostic ignored "-Wcovered-switch-default"
|
||||
#endif
|
||||
#endif // __clang__
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <gsl/gsl_byte> // for byte
|
||||
#include <gsl/gsl_util> // for narrow_cast
|
||||
#include <gsl/multi_span> // for strided_span, index, multi_span, strided_...
|
||||
@ -47,16 +46,14 @@
|
||||
#include <type_traits> // for integral_constant<>::value, is_convertible
|
||||
#include <vector> // for vector
|
||||
|
||||
namespace gsl {
|
||||
struct fail_fast;
|
||||
} // namespace gsl
|
||||
|
||||
using namespace std;
|
||||
using namespace gsl;
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
static const char *deathstring("Expected Death");
|
||||
static constexpr char deathstring[] = "Expected Death";
|
||||
|
||||
struct BaseClass
|
||||
{
|
||||
};
|
||||
@ -815,4 +812,4 @@ TEST(strided_span_tests, strided_span_conversion)
|
||||
|
||||
#if __clang__ || __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
@ -25,12 +25,13 @@
|
||||
//disable warnings from gtest
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
||||
#if __clang__
|
||||
#pragma GCC diagnostic ignored "-Wglobal-constructors"
|
||||
#pragma GCC diagnostic ignored "-Wused-but-marked-unused"
|
||||
#pragma GCC diagnostic ignored "-Wcovered-switch-default"
|
||||
#endif
|
||||
#endif // __clang__
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@ -49,6 +50,10 @@
|
||||
using namespace std;
|
||||
using namespace gsl;
|
||||
|
||||
namespace
|
||||
{
|
||||
static constexpr char deathstring[] = "Expected Death";
|
||||
}
|
||||
// Generic string functions
|
||||
|
||||
namespace generic
|
||||
@ -72,7 +77,6 @@ auto strnlen(const CharT* s, std::size_t n)
|
||||
|
||||
namespace
|
||||
{
|
||||
static const char *deathstring("Expected Death");
|
||||
|
||||
template <typename T>
|
||||
T move_wrapper(T&& t)
|
||||
@ -1233,4 +1237,4 @@ TEST(string_span_tests, as_writeable_bytes)
|
||||
|
||||
#if __clang__ || __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
@ -25,12 +25,14 @@
|
||||
//disable warnings from gtest
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
||||
#if __clang__
|
||||
#pragma GCC diagnostic ignored "-Wglobal-constructors"
|
||||
#pragma GCC diagnostic ignored "-Wused-but-marked-unused"
|
||||
#pragma GCC diagnostic ignored "-Wcovered-switch-default"
|
||||
#endif
|
||||
#endif // __clang__
|
||||
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@ -44,8 +46,9 @@
|
||||
|
||||
using namespace gsl;
|
||||
|
||||
namespace{
|
||||
static const char *deathstring("Expected Death");
|
||||
namespace
|
||||
{
|
||||
static constexpr char deathstring[] = "Expected Death";
|
||||
void f(int& i) { i += 1; }
|
||||
static int j = 0;
|
||||
void g() { j += 1; }
|
||||
@ -153,4 +156,4 @@ TEST(utils_tests, narrow)
|
||||
|
||||
#if __clang__ || __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif // __clang__ || __GNUC__
|
||||
|
Loading…
Reference in New Issue
Block a user