Suppress unsafe-buffer-usage
This commit is contained in:
1 parent
48d105af23
commit
13bb92959b
3 files changed
+26
-12
No files matched your search
+6
-2
@@ -64,10 +64,10 @@
|
||||
#endif
|
||||
|
||||
// Turn off clang unsafe buffer warnings as all accessed are guarded by runtime checks
|
||||
#if defined(__clang__)
|
||||
#if defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
|
||||
#endif // defined(__clang__)
|
||||
#endif // defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")
|
||||
|
||||
namespace gsl
|
||||
{
|
||||
@@ -852,4 +852,8 @@ as_writable_bytes(span<ElementType, Extent> s) noexcept
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__ > 6
|
||||
|
||||
#if defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // GSL_SPAN_H
|
||||
@@ -40,6 +40,12 @@
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
// Turn off clang unsafe buffer warnings as all accessed are guarded by runtime checks
|
||||
#if defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
|
||||
#endif // defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")
|
||||
|
||||
#if defined(__cplusplus) && (__cplusplus >= 201703L)
|
||||
#define GSL_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
@@ -154,4 +160,8 @@ constexpr auto at(std::span<T, extent> sp, const index i) -> decltype(sp[sp.size
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // GSL_UTIL_H
|
||||
Reference in new issue
Block a user