From 3363c5a079523f29268956de0ba6f6b273c096cc Mon Sep 17 00:00:00 2001 From: Christophe Bedard Date: Mon, 11 May 2026 13:07:20 -0700 Subject: [PATCH] Extend noinline to gcc >= 12 to fix -Werror=maybe-uninitialized false positives in gcc 15 (#311) A build failure can be reproduced with colcon's `--mixin coverage-gcc` (or `-DCMAKE_C_FLAGS='--coverage' -DCMAKE_CXX_FLAGS='--coverage'`) on Ubuntu 26.04, which has gcc 15.2.0 by default. Signed-off-by: Christophe Bedard (cherry picked from commit 00e324db59873cb2e364bf88fefa0241f94fa90b) --- include/fastcdr/xcdr/optional.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/fastcdr/xcdr/optional.hpp b/include/fastcdr/xcdr/optional.hpp index 684f2b5d..ab130cb9 100644 --- a/include/fastcdr/xcdr/optional.hpp +++ b/include/fastcdr/xcdr/optional.hpp @@ -92,10 +92,10 @@ class optional //! Destructor ~optional() -#if defined(__GNUC__) && __GNUC__ == 12 +#if defined(__GNUC__) && __GNUC__ >= 12 __attribute__( (noinline)) -#endif // if defined(__GNUC__) && __GNUC__ == 12 +#endif // if defined(__GNUC__) && __GNUC__ >= 12 = default; /*! @@ -212,10 +212,10 @@ class optional //! Assigns content from an optional. optional& operator =( const optional& opt) -#if defined(__GNUC__) && __GNUC__ == 12 +#if defined(__GNUC__) && __GNUC__ >= 12 __attribute__( (noinline)) -#endif // if defined(__GNUC__) && __GNUC__ == 12 +#endif // if defined(__GNUC__) && __GNUC__ >= 12 { reset(); storage_.engaged_ = opt.storage_.engaged_; @@ -229,10 +229,10 @@ class optional //! Assigns content from an optional. optional& operator =( optional&& opt) -#if defined(__GNUC__) && __GNUC__ == 12 +#if defined(__GNUC__) && __GNUC__ >= 12 __attribute__( (noinline)) -#endif // if defined(__GNUC__) && __GNUC__ == 12 +#endif // if defined(__GNUC__) && __GNUC__ >= 12 { reset(); storage_.engaged_ = opt.storage_.engaged_;