diff --git a/hal/src/main/native/include/hal/simulation/SimDataValue.h b/hal/src/main/native/include/hal/simulation/SimDataValue.h index 4368a101bc..7e2b644c7b 100644 --- a/hal/src/main/native/include/hal/simulation/SimDataValue.h +++ b/hal/src/main/native/include/hal/simulation/SimDataValue.h @@ -87,9 +87,21 @@ template class SimDataValue final : public impl::SimDataValueBase { public: +// FIXME: GCC 12.1 gives the false positive "the address of will +// never be NULL" because it doesn't realize the default template parameter can +// make GetDefault nullptr. In C++20, replace "T (*GetDefault)() = nullptr" with +// "T (*GetDefault)() = [] { return T(); }" and unconditionally call +// GetDefault() to fix the warning. +#if __GNUC__ >= 12 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress" +#endif // __GNUC__ >= 12 SimDataValue() : impl::SimDataValueBase( GetDefault != nullptr ? GetDefault() : T()) {} +#if __GNUC__ >= 12 +#pragma GCC diagnostic pop +#endif // __GNUC__ >= 12 explicit SimDataValue(T value) : impl::SimDataValueBase(value) {} diff --git a/upstream_utils/eigen-maybe-uninitialized.patch b/upstream_utils/eigen-maybe-uninitialized.patch deleted file mode 100644 index 27144de70b..0000000000 --- a/upstream_utils/eigen-maybe-uninitialized.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/wpimath/src/main/native/eigeninclude/Eigen/src/Core/util/DisableStupidWarnings.h b/wpimath/src/main/native/eigeninclude/Eigen/src/Core/util/DisableStupidWarnings.h -index 74f74cc42..5fe86fa0d 100644 ---- a/wpimath/src/main/native/eigeninclude/Eigen/src/Core/util/DisableStupidWarnings.h -+++ b/wpimath/src/main/native/eigeninclude/Eigen/src/Core/util/DisableStupidWarnings.h -@@ -61,6 +61,10 @@ - // See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89325 - #pragma GCC diagnostic ignored "-Wattributes" - #endif -+ #if __GNUC__==11 -+ // This warning is a false positive -+ #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -+ #endif - #endif - - #if defined __NVCC__ diff --git a/upstream_utils/eigen_patches/0001-Disable-warnings.patch b/upstream_utils/eigen_patches/0001-Disable-warnings.patch new file mode 100644 index 0000000000..680b0d2d53 --- /dev/null +++ b/upstream_utils/eigen_patches/0001-Disable-warnings.patch @@ -0,0 +1,31 @@ +From 6257b7a01bb498bd895e27146528f9362152e447 Mon Sep 17 00:00:00 2001 +From: Tyler Veness +Date: Wed, 18 May 2022 09:14:24 -0700 +Subject: [PATCH] Disable warnings + +--- + Eigen/src/Core/util/DisableStupidWarnings.h | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/Eigen/src/Core/util/DisableStupidWarnings.h b/Eigen/src/Core/util/DisableStupidWarnings.h +index fe0cfec0b..f489c3add 100755 +--- a/Eigen/src/Core/util/DisableStupidWarnings.h ++++ b/Eigen/src/Core/util/DisableStupidWarnings.h +@@ -71,6 +71,14 @@ + // See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89325 + #pragma GCC diagnostic ignored "-Wattributes" + #endif ++ #if __GNUC__==11 ++ // This warning is a false positive ++ #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" ++ #endif ++ #if __GNUC__==12 ++ // This warning is a false positive ++ #pragma GCC diagnostic ignored "-Warray-bounds" ++ #endif + #endif + + #if defined __NVCC__ +-- +2.36.1 + diff --git a/upstream_utils/libuv_patches/0001-Fix-missing-casts.patch b/upstream_utils/libuv_patches/0001-Fix-missing-casts.patch index 49545dbf79..a4a80aa22f 100644 --- a/upstream_utils/libuv_patches/0001-Fix-missing-casts.patch +++ b/upstream_utils/libuv_patches/0001-Fix-missing-casts.patch @@ -1,7 +1,7 @@ -From bb42f9b81e12e52b5401c4afa879242b46615a4e Mon Sep 17 00:00:00 2001 +From d4f625eae1faf75f3a195f7a918d6d09c626243e Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Tue, 26 Apr 2022 15:01:25 -0400 -Subject: [PATCH 1/6] Fix missing casts +Subject: [PATCH 1/7] Fix missing casts --- include/uv/unix.h | 2 +- @@ -1414,5 +1414,5 @@ index 7ca83213..d1cd19ba 100644 if (*utf16 == NULL) return UV_ENOMEM; -- -2.20.1.windows.1 +2.36.1 diff --git a/upstream_utils/libuv_patches/0002-Fix-warnings.patch b/upstream_utils/libuv_patches/0002-Fix-warnings.patch index 2ae3f3b4da..f3ff4de4c1 100644 --- a/upstream_utils/libuv_patches/0002-Fix-warnings.patch +++ b/upstream_utils/libuv_patches/0002-Fix-warnings.patch @@ -1,7 +1,7 @@ -From c2390ddd8fa648c87adf279ed5b3489a42c07e67 Mon Sep 17 00:00:00 2001 +From 6a2f0c13071618ae8cbf84bff2e659b862e57ecd Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Tue, 26 Apr 2022 15:09:43 -0400 -Subject: [PATCH 2/6] Fix warnings +Subject: [PATCH 2/7] Fix warnings --- include/uv/win.h | 5 +++++ @@ -247,5 +247,5 @@ index a5d58bf7..deec66fe 100644 #include #include -- -2.20.1.windows.1 +2.36.1 diff --git a/upstream_utils/libuv_patches/0003-Preprocessor-cleanup.patch b/upstream_utils/libuv_patches/0003-Preprocessor-cleanup.patch index 5f3a255fa8..cfcf462410 100644 --- a/upstream_utils/libuv_patches/0003-Preprocessor-cleanup.patch +++ b/upstream_utils/libuv_patches/0003-Preprocessor-cleanup.patch @@ -1,7 +1,7 @@ -From 80055296378f0a8ad0eec823fd2d0209a447fd22 Mon Sep 17 00:00:00 2001 +From b2ce6f41afa612eb31a8c8ac3e5f23783fb81d5f Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Tue, 26 Apr 2022 15:19:14 -0400 -Subject: [PATCH 3/6] Preprocessor cleanup +Subject: [PATCH 3/7] Preprocessor cleanup --- include/uv.h | 18 +----------------- @@ -198,5 +198,5 @@ index 5820ba9c..918acaf5 100644 /* Whether there are any non-IFS LSPs stacked on TCP */ int uv_tcp_non_ifs_lsp_ipv4; -- -2.20.1.windows.1 +2.36.1 diff --git a/upstream_utils/libuv_patches/0004-Cleanup-problematic-language.patch b/upstream_utils/libuv_patches/0004-Cleanup-problematic-language.patch index 37f8be080f..191b53856f 100644 --- a/upstream_utils/libuv_patches/0004-Cleanup-problematic-language.patch +++ b/upstream_utils/libuv_patches/0004-Cleanup-problematic-language.patch @@ -1,7 +1,7 @@ -From 5649a07d496fecd1812265b86b329186af78c3fc Mon Sep 17 00:00:00 2001 +From ea00b73593e7146c01df4320e3e2e345665fd1c3 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Tue, 26 Apr 2022 15:24:47 -0400 -Subject: [PATCH 4/6] Cleanup problematic language +Subject: [PATCH 4/7] Cleanup problematic language --- src/unix/tty.c | 21 +++++++++++---------- @@ -60,5 +60,5 @@ index 74d3d75d..5f681406 100644 else r = -1; -- -2.20.1.windows.1 +2.36.1 diff --git a/upstream_utils/libuv_patches/0005-Use-roborio-time.patch b/upstream_utils/libuv_patches/0005-Use-roborio-time.patch index 313c2b6a0e..6fc74461bb 100644 --- a/upstream_utils/libuv_patches/0005-Use-roborio-time.patch +++ b/upstream_utils/libuv_patches/0005-Use-roborio-time.patch @@ -1,7 +1,7 @@ -From bb5cdf6360308dce34546f55d02f8073b88dd748 Mon Sep 17 00:00:00 2001 +From a033a549b944b5ea9d9b2d8c7e73bbf8165232ec Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Tue, 26 Apr 2022 15:26:03 -0400 -Subject: [PATCH 5/6] Use roborio time +Subject: [PATCH 5/7] Use roborio time --- src/unix/linux-core.c | 8 ++++++++ @@ -41,5 +41,5 @@ index a66bb535..8a267823 100644 -- -2.20.1.windows.1 +2.36.1 diff --git a/upstream_utils/libuv_patches/0006-Style-comments-cleanup.patch b/upstream_utils/libuv_patches/0006-Style-comments-cleanup.patch index 90f1ae2d75..f0c98d4f02 100644 --- a/upstream_utils/libuv_patches/0006-Style-comments-cleanup.patch +++ b/upstream_utils/libuv_patches/0006-Style-comments-cleanup.patch @@ -1,7 +1,7 @@ -From a9ec38882aa39841109dd001b1122c2ff60454e6 Mon Sep 17 00:00:00 2001 +From 88a584f62e18a04a70336027062141739e1591bf Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Tue, 26 Apr 2022 15:28:52 -0400 -Subject: [PATCH 6/6] Style / comments cleanup +Subject: [PATCH 6/7] Style / comments cleanup --- src/fs-poll.c | 1 + @@ -101,5 +101,5 @@ index 918acaf5..668e3b64 100644 /* Whether there are any non-IFS LSPs stacked on TCP */ -- -2.20.1.windows.1 +2.36.1 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 new file mode 100644 index 0000000000..10da95e088 --- /dev/null +++ b/upstream_utils/libuv_patches/0007-Squelch-GCC-12.1-warnings.patch @@ -0,0 +1,55 @@ +From aca70965b0a80000cb8281d097c78a3e3e0feb16 Mon Sep 17 00:00:00 2001 +From: Tyler Veness +Date: Tue, 17 May 2022 21:36:57 -0700 +Subject: [PATCH 7/7] 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 f3a8e66d..8aeca159 100644 +--- a/src/unix/stream.c ++++ b/src/unix/stream.c +@@ -932,7 +932,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 3c65476a..fd56b013 100644 +--- a/src/uv-common.c ++++ b/src/uv-common.c +@@ -444,7 +444,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); +-- +2.36.1 + diff --git a/upstream_utils/update_eigen.py b/upstream_utils/update_eigen.py index 0df72a8d77..b080764fe9 100755 --- a/upstream_utils/update_eigen.py +++ b/upstream_utils/update_eigen.py @@ -4,7 +4,7 @@ import os import re import shutil -from upstream_utils import setup_upstream_repo, comment_out_invalid_includes, walk_cwd_and_copy_if, apply_patches +from upstream_utils import setup_upstream_repo, comment_out_invalid_includes, walk_cwd_and_copy_if, am_patches def eigen_inclusions(dp, f): @@ -91,6 +91,10 @@ def main(): "3.4.0") wpimath = os.path.join(root, "wpimath") + # Apply patches to original git repo + prefix = os.path.join(root, "upstream_utils/eigen_patches") + am_patches(repo, [os.path.join(prefix, "0001-Disable-warnings.patch")]) + # Delete old install for d in [ "src/main/native/eigeninclude/Eigen", @@ -114,8 +118,6 @@ def main(): comment_out_invalid_includes( f, [os.path.join(wpimath, "src/main/native/eigeninclude")]) - apply_patches(root, ["upstream_utils/eigen-maybe-uninitialized.patch"]) - if __name__ == "__main__": main() diff --git a/upstream_utils/update_libuv.py b/upstream_utils/update_libuv.py index b0914031b2..8c7ef3fb2e 100755 --- a/upstream_utils/update_libuv.py +++ b/upstream_utils/update_libuv.py @@ -20,6 +20,7 @@ def main(): os.path.join(root, "upstream_utils/libuv_patches/0004-Cleanup-problematic-language.patch"), os.path.join(root, "upstream_utils/libuv_patches/0005-Use-roborio-time.patch"), os.path.join(root, "upstream_utils/libuv_patches/0006-Style-comments-cleanup.patch"), + os.path.join(root, "upstream_utils/libuv_patches/0007-Squelch-GCC-12.1-warnings.patch"), ]) # yapf: enable diff --git a/wpimath/src/main/native/eigeninclude/Eigen/src/Core/util/DisableStupidWarnings.h b/wpimath/src/main/native/eigeninclude/Eigen/src/Core/util/DisableStupidWarnings.h index 3bec07233f..f489c3add6 100644 --- a/wpimath/src/main/native/eigeninclude/Eigen/src/Core/util/DisableStupidWarnings.h +++ b/wpimath/src/main/native/eigeninclude/Eigen/src/Core/util/DisableStupidWarnings.h @@ -75,6 +75,10 @@ // This warning is a false positive #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif + #if __GNUC__==12 + // This warning is a false positive + #pragma GCC diagnostic ignored "-Warray-bounds" + #endif #endif #if defined __NVCC__ 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 f3a8e66dcd..8aeca159b2 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/unix/stream.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/unix/stream.cpp @@ -932,7 +932,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/wpinet/src/main/native/thirdparty/libuv/src/uv-common.cpp b/wpinet/src/main/native/thirdparty/libuv/src/uv-common.cpp index 3c65476af6..fd56b01349 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/uv-common.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/uv-common.cpp @@ -444,7 +444,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);