diff --git a/glass/src/lib/native/include/glass/Context.h b/glass/src/lib/native/include/glass/Context.h index e8dada347e..f343d33582 100644 --- a/glass/src/lib/native/include/glass/Context.h +++ b/glass/src/lib/native/include/glass/Context.h @@ -4,6 +4,8 @@ #pragma once +#include + #include #include #include diff --git a/upstream_utils/eigen_patches/0001-Disable-warnings.patch b/upstream_utils/eigen_patches/0001-Disable-warnings.patch index 300e155c8e..e89fec5f73 100644 --- a/upstream_utils/eigen_patches/0001-Disable-warnings.patch +++ b/upstream_utils/eigen_patches/0001-Disable-warnings.patch @@ -8,7 +8,7 @@ Subject: [PATCH 1/3] Disable warnings 1 file changed, 11 insertions(+) diff --git a/Eigen/src/Core/util/DisableStupidWarnings.h b/Eigen/src/Core/util/DisableStupidWarnings.h -index fe0cfec0bc2461ac44abca8f3d05b468d3c60fd9..d973255943c55709f318888bd0d243c73c327ad1 100755 +index fe0cfec0bc2461ac44abca8f3d05b468d3c60fd9..9a630e4ae692aee0277d60b3083c968d087920dd 100755 --- a/Eigen/src/Core/util/DisableStupidWarnings.h +++ b/Eigen/src/Core/util/DisableStupidWarnings.h @@ -71,6 +71,17 @@ @@ -22,7 +22,7 @@ index fe0cfec0bc2461ac44abca8f3d05b468d3c60fd9..d973255943c55709f318888bd0d243c7 + // This warning is a false positive + #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" + #endif -+ #if __GNUC__==12 ++ #if __GNUC__>=12 + // This warning is a false positive + #pragma GCC diagnostic ignored "-Warray-bounds" + #endif diff --git a/upstream_utils/fmt_patches/0001-Don-t-throw-on-write-failure.patch b/upstream_utils/fmt_patches/0001-Don-t-throw-on-write-failure.patch index 941b574a13..c9773bd475 100644 --- a/upstream_utils/fmt_patches/0001-Don-t-throw-on-write-failure.patch +++ b/upstream_utils/fmt_patches/0001-Don-t-throw-on-write-failure.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Wed, 18 May 2022 10:21:49 -0700 -Subject: [PATCH 1/2] Don't throw on write failure +Subject: [PATCH 1/3] Don't throw on write failure --- include/fmt/format-inl.h | 4 +--- diff --git a/upstream_utils/fmt_patches/0002-Suppress-C-20-clang-tidy-warning-false-positive.patch b/upstream_utils/fmt_patches/0002-Suppress-C-20-clang-tidy-warning-false-positive.patch index a34499fe5d..c239a68839 100644 --- a/upstream_utils/fmt_patches/0002-Suppress-C-20-clang-tidy-warning-false-positive.patch +++ b/upstream_utils/fmt_patches/0002-Suppress-C-20-clang-tidy-warning-false-positive.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Fri, 2 Sep 2022 15:12:54 -0700 -Subject: [PATCH 2/2] Suppress C++20 clang-tidy warning false positive +Subject: [PATCH 2/3] Suppress C++20 clang-tidy warning false positive --- include/fmt/core.h | 2 +- diff --git a/upstream_utils/fmt_patches/0003-Suppress-warnings-we-can-t-fix.patch b/upstream_utils/fmt_patches/0003-Suppress-warnings-we-can-t-fix.patch new file mode 100644 index 0000000000..81b2435e0a --- /dev/null +++ b/upstream_utils/fmt_patches/0003-Suppress-warnings-we-can-t-fix.patch @@ -0,0 +1,65 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tyler Veness +Date: Sat, 13 May 2023 15:18:52 -0700 +Subject: [PATCH 3/3] Suppress warnings we can't fix + +--- + include/fmt/core.h | 7 +++++++ + include/fmt/format.h | 15 +++++++++++++++ + 2 files changed, 22 insertions(+) + +diff --git a/include/fmt/core.h b/include/fmt/core.h +index 5c210bcb8428dba6419a055b2dd47bd717f5dbab..962115af6db9904fc5ae8f4b2c094ada7de7a8a1 100644 +--- a/include/fmt/core.h ++++ b/include/fmt/core.h +@@ -1732,7 +1732,14 @@ constexpr auto encode_types() -> unsigned long long { + + template + FMT_CONSTEXPR FMT_INLINE auto make_value(T&& val) -> value { ++#if FMT_GCC_VERSION && FMT_GCC_VERSION >= 1300 ++# pragma GCC diagnostic push ++# pragma GCC diagnostic ignored "-Wdangling-reference" ++#endif + const auto& arg = arg_mapper().map(FMT_FORWARD(val)); ++#if FMT_GCC_VERSION && FMT_GCC_VERSION >= 1300 ++# pragma GCC diagnostic pop ++#endif + + constexpr bool formattable_char = + !std::is_same::value; +diff --git a/include/fmt/format.h b/include/fmt/format.h +index 7c607dbd30421b5bc57aaafc1edabeafdf2a3ea0..60b806d5e65441f9aed8a410f0f88ceac4f4fb32 100644 +--- a/include/fmt/format.h ++++ b/include/fmt/format.h +@@ -922,8 +922,16 @@ FMT_CONSTEXPR20 void basic_memory_buffer::grow( + T* new_data = + std::allocator_traits::allocate(alloc_, new_capacity); + // The following code doesn't throw, so the raw pointer above doesn't leak. ++#if FMT_GCC_VERSION && FMT_GCC_VERSION >= 1300 ++# pragma GCC diagnostic push ++# pragma GCC diagnostic ignored "-Warray-bounds" ++# pragma GCC diagnostic ignored "-Wstringop-overflow" ++#endif + std::uninitialized_copy(old_data, old_data + this->size(), + detail::make_checked(new_data, new_capacity)); ++#if FMT_GCC_VERSION && FMT_GCC_VERSION >= 1300 ++# pragma GCC diagnostic pop ++#endif + this->set(new_data, new_capacity); + // deallocate must not throw according to the standard, but even if it does, + // the buffer already uses the new storage and will deallocate it in +@@ -2804,7 +2812,14 @@ class bigint { + auto size = other.bigits_.size(); + bigits_.resize(size); + auto data = other.bigits_.data(); ++#if FMT_GCC_VERSION && FMT_GCC_VERSION >= 1300 ++# pragma GCC diagnostic push ++# pragma GCC diagnostic ignored "-Warray-bounds" ++#endif + std::copy(data, data + size, make_checked(bigits_.data(), size)); ++#if FMT_GCC_VERSION && FMT_GCC_VERSION >= 1300 ++# pragma GCC diagnostic pop ++#endif + exp_ = other.exp_; + } + diff --git a/upstream_utils/libuv_patches/0007-Squelch-GCC-12.1-warnings.patch b/upstream_utils/libuv_patches/0007-Squelch-GCC-12.1-warnings.patch deleted file mode 100644 index 9c1d894dae..0000000000 --- a/upstream_utils/libuv_patches/0007-Squelch-GCC-12.1-warnings.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Tyler Veness -Date: Tue, 17 May 2022 21:36:57 -0700 -Subject: [PATCH 7/9] Squelch GCC 12.1 warnings - ---- - src/unix/stream.c | 9 +++++++++ - src/uv-common.c | 9 +++++++++ - 2 files changed, 18 insertions(+) - -diff --git a/src/unix/stream.c b/src/unix/stream.c -index c6cc50e709989f30f4393b509d859663717d1770..fa25812a6b6e9b3c221e8ec64db0c54db476fbb0 100644 ---- a/src/unix/stream.c -+++ b/src/unix/stream.c -@@ -938,7 +938,16 @@ static void uv__write_callbacks(uv_stream_t* stream) { - if (QUEUE_EMPTY(&stream->write_completed_queue)) - return; - -+// FIXME: GCC 12.1 gives a possibly real warning, but we don't know how to fix -+// it -+#if __GNUC__ >= 12 -+#pragma GCC diagnostic push -+#pragma GCC diagnostic ignored "-Wdangling-pointer=" -+#endif // __GNUC__ >= 12 - QUEUE_MOVE(&stream->write_completed_queue, &pq); -+#if __GNUC__ >= 12 -+#pragma GCC diagnostic pop -+#endif // __GNUC__ >= 12 - - while (!QUEUE_EMPTY(&pq)) { - /* Pop a req off write_completed_queue. */ -diff --git a/src/uv-common.c b/src/uv-common.c -index c9a32c0336777aa3a41cac7cb7a4c23ad3f677da..8ab600dfdbcc8fda40f13126f17013f1c39da838 100644 ---- a/src/uv-common.c -+++ b/src/uv-common.c -@@ -504,7 +504,16 @@ void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg) { - QUEUE* q; - uv_handle_t* h; - -+// FIXME: GCC 12.1 gives a possibly real warning, but we don't know how to fix -+// it -+#if __GNUC__ >= 12 -+#pragma GCC diagnostic push -+#pragma GCC diagnostic ignored "-Wdangling-pointer=" -+#endif // __GNUC__ >= 12 - QUEUE_MOVE(&loop->handle_queue, &queue); -+#if __GNUC__ >= 12 -+#pragma GCC diagnostic pop -+#endif // __GNUC__ >= 12 - while (!QUEUE_EMPTY(&queue)) { - q = QUEUE_HEAD(&queue); - h = QUEUE_DATA(q, uv_handle_t, handle_queue); diff --git a/upstream_utils/libuv_patches/0007-Squelch-GCC-warnings-we-don-t-know-how-to-fix.patch b/upstream_utils/libuv_patches/0007-Squelch-GCC-warnings-we-don-t-know-how-to-fix.patch new file mode 100644 index 0000000000..5ec9fa160f --- /dev/null +++ b/upstream_utils/libuv_patches/0007-Squelch-GCC-warnings-we-don-t-know-how-to-fix.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tyler Veness +Date: Tue, 17 May 2022 21:36:57 -0700 +Subject: [PATCH 7/9] Squelch GCC warnings we don't know how to fix + +--- + src/queue.h | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/src/queue.h b/src/queue.h +index ff3540a0a51c840d7ff5e6a3cea95f24c27b0812..c0d5efc187c78f7d60776447be492a9310c3b36c 100644 +--- a/src/queue.h ++++ b/src/queue.h +@@ -58,6 +58,7 @@ typedef void *QUEUE[2]; + } \ + while (0) + ++#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 12 + #define QUEUE_SPLIT(h, q, n) \ + do { \ + QUEUE_PREV(n) = QUEUE_PREV(h); \ +@@ -65,9 +66,24 @@ typedef void *QUEUE[2]; + QUEUE_NEXT(n) = (q); \ + QUEUE_PREV(h) = QUEUE_PREV(q); \ + QUEUE_PREV_NEXT(h) = (h); \ ++ _Pragma("GCC diagnostic push") \ ++ _Pragma("GCC diagnostic ignored \"-Wdangling-pointer=\"") \ + QUEUE_PREV(q) = (n); \ ++ _Pragma("GCC diagnostic pop") \ + } \ + while (0) ++#else ++#define QUEUE_SPLIT(h, q, n) \ ++ do { \ ++ QUEUE_PREV(n) = QUEUE_PREV(h); \ ++ QUEUE_PREV_NEXT(n) = (n); \ ++ QUEUE_NEXT(n) = (q); \ ++ QUEUE_PREV(h) = QUEUE_PREV(q); \ ++ QUEUE_PREV_NEXT(h) = (h); \ ++ QUEUE_PREV(q) = (n); \ ++ } \ ++ while (0) ++#endif // defined(__GNUC__) && !defined(__clang__) + + #define QUEUE_MOVE(h, n) \ + do { \ diff --git a/upstream_utils/update_fmt.py b/upstream_utils/update_fmt.py index 1088c3937b..212554a56d 100755 --- a/upstream_utils/update_fmt.py +++ b/upstream_utils/update_fmt.py @@ -22,6 +22,7 @@ def main(): for f in [ "0001-Don-t-throw-on-write-failure.patch", "0002-Suppress-C-20-clang-tidy-warning-false-positive.patch", + "0003-Suppress-warnings-we-can-t-fix.patch", ]: git_am(os.path.join(wpilib_root, "upstream_utils/fmt_patches", f)) diff --git a/upstream_utils/update_libuv.py b/upstream_utils/update_libuv.py index a90a6d74f6..604bbdbe89 100755 --- a/upstream_utils/update_libuv.py +++ b/upstream_utils/update_libuv.py @@ -26,7 +26,7 @@ def main(): "0004-Cleanup-problematic-language.patch", "0005-Use-roborio-time.patch", "0006-Style-comments-cleanup.patch", - "0007-Squelch-GCC-12.1-warnings.patch", + "0007-Squelch-GCC-warnings-we-don-t-know-how-to-fix.patch", "0008-Fix-Win32-warning-suppression-pragma.patch", "0009-Avoid-unused-variable-warning-on-Mac.patch", ]: diff --git a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/util/DisableStupidWarnings.h b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/util/DisableStupidWarnings.h index d973255943..9a630e4ae6 100644 --- a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/util/DisableStupidWarnings.h +++ b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/util/DisableStupidWarnings.h @@ -78,7 +78,7 @@ // This warning is a false positive #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif - #if __GNUC__==12 + #if __GNUC__>=12 // This warning is a false positive #pragma GCC diagnostic ignored "-Warray-bounds" #endif diff --git a/wpinet/src/main/native/thirdparty/libuv/src/queue.h b/wpinet/src/main/native/thirdparty/libuv/src/queue.h index ff3540a0a5..c0d5efc187 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/queue.h +++ b/wpinet/src/main/native/thirdparty/libuv/src/queue.h @@ -58,6 +58,21 @@ typedef void *QUEUE[2]; } \ while (0) +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 12 +#define QUEUE_SPLIT(h, q, n) \ + do { \ + QUEUE_PREV(n) = QUEUE_PREV(h); \ + QUEUE_PREV_NEXT(n) = (n); \ + QUEUE_NEXT(n) = (q); \ + QUEUE_PREV(h) = QUEUE_PREV(q); \ + QUEUE_PREV_NEXT(h) = (h); \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wdangling-pointer=\"") \ + QUEUE_PREV(q) = (n); \ + _Pragma("GCC diagnostic pop") \ + } \ + while (0) +#else #define QUEUE_SPLIT(h, q, n) \ do { \ QUEUE_PREV(n) = QUEUE_PREV(h); \ @@ -68,6 +83,7 @@ typedef void *QUEUE[2]; QUEUE_PREV(q) = (n); \ } \ while (0) +#endif // defined(__GNUC__) && !defined(__clang__) #define QUEUE_MOVE(h, n) \ do { \ diff --git a/wpinet/src/main/native/thirdparty/libuv/src/unix/stream.cpp b/wpinet/src/main/native/thirdparty/libuv/src/unix/stream.cpp index fa25812a6b..c6cc50e709 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/unix/stream.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/unix/stream.cpp @@ -938,16 +938,7 @@ static void uv__write_callbacks(uv_stream_t* stream) { if (QUEUE_EMPTY(&stream->write_completed_queue)) return; -// FIXME: GCC 12.1 gives a possibly real warning, but we don't know how to fix -// it -#if __GNUC__ >= 12 -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdangling-pointer=" -#endif // __GNUC__ >= 12 QUEUE_MOVE(&stream->write_completed_queue, &pq); -#if __GNUC__ >= 12 -#pragma GCC diagnostic pop -#endif // __GNUC__ >= 12 while (!QUEUE_EMPTY(&pq)) { /* Pop a req off write_completed_queue. */ diff --git a/wpinet/src/main/native/thirdparty/libuv/src/uv-common.cpp b/wpinet/src/main/native/thirdparty/libuv/src/uv-common.cpp index 8ab600dfdb..c9a32c0336 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/uv-common.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/uv-common.cpp @@ -504,16 +504,7 @@ void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg) { QUEUE* q; uv_handle_t* h; -// FIXME: GCC 12.1 gives a possibly real warning, but we don't know how to fix -// it -#if __GNUC__ >= 12 -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdangling-pointer=" -#endif // __GNUC__ >= 12 QUEUE_MOVE(&loop->handle_queue, &queue); -#if __GNUC__ >= 12 -#pragma GCC diagnostic pop -#endif // __GNUC__ >= 12 while (!QUEUE_EMPTY(&queue)) { q = QUEUE_HEAD(&queue); h = QUEUE_DATA(q, uv_handle_t, handle_queue); diff --git a/wpiutil/src/main/native/include/wpi/Base64.h b/wpiutil/src/main/native/include/wpi/Base64.h index c410bd0c26..858ff73fff 100644 --- a/wpiutil/src/main/native/include/wpi/Base64.h +++ b/wpiutil/src/main/native/include/wpi/Base64.h @@ -5,6 +5,8 @@ #ifndef WPIUTIL_WPI_BASE64_H_ #define WPIUTIL_WPI_BASE64_H_ +#include + #include #include #include diff --git a/wpiutil/src/main/native/thirdparty/fmtlib/include/fmt/core.h b/wpiutil/src/main/native/thirdparty/fmtlib/include/fmt/core.h index 5c210bcb84..962115af6d 100644 --- a/wpiutil/src/main/native/thirdparty/fmtlib/include/fmt/core.h +++ b/wpiutil/src/main/native/thirdparty/fmtlib/include/fmt/core.h @@ -1732,7 +1732,14 @@ constexpr auto encode_types() -> unsigned long long { template FMT_CONSTEXPR FMT_INLINE auto make_value(T&& val) -> value { +#if FMT_GCC_VERSION && FMT_GCC_VERSION >= 1300 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wdangling-reference" +#endif const auto& arg = arg_mapper().map(FMT_FORWARD(val)); +#if FMT_GCC_VERSION && FMT_GCC_VERSION >= 1300 +# pragma GCC diagnostic pop +#endif constexpr bool formattable_char = !std::is_same::value; diff --git a/wpiutil/src/main/native/thirdparty/fmtlib/include/fmt/format.h b/wpiutil/src/main/native/thirdparty/fmtlib/include/fmt/format.h index 7c607dbd30..60b806d5e6 100644 --- a/wpiutil/src/main/native/thirdparty/fmtlib/include/fmt/format.h +++ b/wpiutil/src/main/native/thirdparty/fmtlib/include/fmt/format.h @@ -922,8 +922,16 @@ FMT_CONSTEXPR20 void basic_memory_buffer::grow( T* new_data = std::allocator_traits::allocate(alloc_, new_capacity); // The following code doesn't throw, so the raw pointer above doesn't leak. +#if FMT_GCC_VERSION && FMT_GCC_VERSION >= 1300 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Warray-bounds" +# pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif std::uninitialized_copy(old_data, old_data + this->size(), detail::make_checked(new_data, new_capacity)); +#if FMT_GCC_VERSION && FMT_GCC_VERSION >= 1300 +# pragma GCC diagnostic pop +#endif this->set(new_data, new_capacity); // deallocate must not throw according to the standard, but even if it does, // the buffer already uses the new storage and will deallocate it in @@ -2804,7 +2812,14 @@ class bigint { auto size = other.bigits_.size(); bigits_.resize(size); auto data = other.bigits_.data(); +#if FMT_GCC_VERSION && FMT_GCC_VERSION >= 1300 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Warray-bounds" +#endif std::copy(data, data + size, make_checked(bigits_.data(), size)); +#if FMT_GCC_VERSION && FMT_GCC_VERSION >= 1300 +# pragma GCC diagnostic pop +#endif exp_ = other.exp_; }