1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
From aa4fd1f57794964640005900c2b47af1a0940b7b Mon Sep 17 00:00:00 2001
From: Werner Henze <w.henze@avm.de>
Date: Fri, 1 Mar 2024 15:53:50 +0100
Subject: [PATCH] Fix gcc build problem
Closes issue #1148 by fixing problems introduced in PR #1140.
Upstream-Status: Submitted [https://github.com/microsoft/GSL/pull/1149]
Signed-off-by: Peter Marko <peter.marko@siemens.com>
---
include/gsl/span | 12 ++++++++----
include/gsl/util | 12 ++++++++----
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/include/gsl/span b/include/gsl/span
index 0de2932..d2ef9f7 100644
--- a/include/gsl/span
+++ b/include/gsl/span
@@ -59,10 +59,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
{
@@ -824,8 +826,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
diff --git a/include/gsl/util b/include/gsl/util
index b853017..26b2f5f 100644
--- a/include/gsl/util
+++ b/include/gsl/util
@@ -40,10 +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")
+#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]]
@@ -163,8 +165,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
--
2.30.2
|