Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gcc build problem #1149

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions include/gsl/span
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@
#endif

// Turn off clang unsafe buffer warnings as all accessed are guarded by runtime checks
#if defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")
#if defined(__clang__)
#if __has_warning("-Wunsafe-buffer-usage")
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif // defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")
#endif // __has_warning("-Wunsafe-buffer-usage")
#endif // defined(__clang__)

namespace gsl
{
Expand Down Expand Up @@ -852,8 +854,10 @@ as_writable_bytes(span<ElementType, Extent> s) noexcept
#pragma GCC diagnostic pop
#endif // __GNUC__ > 6

#if defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")
#if defined(__clang__)
#if __has_warning("-Wunsafe-buffer-usage")
#pragma clang diagnostic pop
#endif
#endif // __has_warning("-Wunsafe-buffer-usage")
#endif // defined(__clang__)

#endif // GSL_SPAN_H
12 changes: 8 additions & 4 deletions include/gsl/util
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,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")
#if defined(__clang__)
#if __has_warning("-Wunsafe-buffer-usage")
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif // defined(__clang__) && __has_warning("-Wunsafe-buffer-usage")
#endif // __has_warning("-Wunsafe-buffer-usage")
#endif // defined(__clang__)

#if defined(__cplusplus) && (__cplusplus >= 201703L)
#define GSL_NODISCARD [[nodiscard]]
Expand Down Expand Up @@ -160,8 +162,10 @@ 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")
#if defined(__clang__)
#if __has_warning("-Wunsafe-buffer-usage")
#pragma clang diagnostic pop
#endif
#endif // __has_warning("-Wunsafe-buffer-usage")
#endif // defined(__clang__)

#endif // GSL_UTIL_H
Loading