[gcc r13-2648] libstdc++: Avoid -Wparentheses warning with debug iterators

Patrick Palka ppalka@gcc.gnu.org
Tue Sep 13 14:42:04 GMT 2022


https://gcc.gnu.org/g:edf6fe7800369136c1a8ddcaf75a042a3a938c84

commit r13-2648-gedf6fe7800369136c1a8ddcaf75a042a3a938c84
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Sep 13 10:41:47 2022 -0400

    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:
---
 libstdc++-v3/include/debug/safe_iterator.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h
index 33f7a86478a..117dc93de60 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)				\


More information about the Libstdc++-cvs mailing list