From: Patrick Palka Date: Tue, 13 Sep 2022 14:41:47 +0000 (-0400) Subject: libstdc++: Avoid -Wparentheses warning with debug iterators X-Git-Tag: basepoints/gcc-14~4559 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edf6fe7800369136c1a8ddcaf75a042a3a938c84;p=thirdparty%2Fgcc.git libstdc++: Avoid -Wparentheses warning with debug iterators I noticed compiling e.g. std/ranges/adaptors/join.cc with -D_GLIBCXX_DEBUG -Wsystem-headers -Wall gives the warning: gcc/libstdc++-v3/include/debug/safe_iterator.h:477:9: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] libstdc++-v3/ChangeLog: * include/debug/safe_iterator.h (_GLIBCXX_DEBUG_VERIFY_OPERANDS): Add parentheses to avoid -Wparentheses warning. --- diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h index 33f7a86478ad..117dc93de602 100644 --- a/libstdc++-v3/include/debug/safe_iterator.h +++ b/libstdc++-v3/include/debug/safe_iterator.h @@ -40,7 +40,7 @@ #endif #define _GLIBCXX_DEBUG_VERIFY_OPERANDS(_Lhs, _Rhs, _BadMsgId, _DiffMsgId) \ - _GLIBCXX_DEBUG_VERIFY(!_Lhs._M_singular() && !_Rhs._M_singular() \ + _GLIBCXX_DEBUG_VERIFY((!_Lhs._M_singular() && !_Rhs._M_singular()) \ || (_Lhs._M_value_initialized() \ && _Rhs._M_value_initialized()), \ _M_message(_BadMsgId) \