From 9f3da8de1b784a9b17640fc0063a08b81a7b4459 Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Tue, 27 Aug 2024 20:07:46 -0400 Subject: [PATCH] [hal] Correct warning suppression and note in SimDataValue.h (#7009) --- .../include/hal/simulation/SimDataValue.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hal/src/main/native/include/hal/simulation/SimDataValue.h b/hal/src/main/native/include/hal/simulation/SimDataValue.h index 0f0cde59c8..8c909fae28 100644 --- a/hal/src/main/native/include/hal/simulation/SimDataValue.h +++ b/hal/src/main/native/include/hal/simulation/SimDataValue.h @@ -87,21 +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 +// FIXME: GCC gives the false positive "the address of will never +// be NULL" because it doesn't realize the default template parameter can make +// GetDefault nullptr. Fixed in GCC 13. +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94554 +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105885 +#if __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Waddress" -#endif // __GNUC__ >= 12 +#endif // __GNUC__ SimDataValue() : impl::SimDataValueBase( GetDefault != nullptr ? GetDefault() : T()) {} -#if __GNUC__ >= 12 +#if __GNUC__ #pragma GCC diagnostic pop -#endif // __GNUC__ >= 12 +#endif // __GNUC__ explicit SimDataValue(T value) : impl::SimDataValueBase(value) {}