[PATCH] libstdc++: Squelch -Wparentheses warning with debug iterators
Jonathan Wakely
jwakely@redhat.com
Tue Sep 13 10:47:17 GMT 2022
On Mon, 12 Sept 2022 at 18:40, Patrick Palka via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> 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]
>
> Tested on x86_64-pc-linux-gnu, does this look OK for trunk?
OK, thanks.
>
> libstdc++-v3/ChangeLog:
>
> * include/debug/safe_iterator.h (_GLIBCXX_DEBUG_VERIFY_OPERANDS):
> Add parentheses to squelch -Wparentheses.
> ---
> 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) \
> --
> 2.37.3.542.gdd3f6c4cae
>
More information about the Libstdc++
mailing list