public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Squelch -Wparentheses warning with debug iterators
@ 2022-09-12 17:39 Patrick Palka
  2022-09-13 10:47 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Palka @ 2022-09-12 17:39 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Patrick Palka

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?

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libstdc++: Squelch -Wparentheses warning with debug iterators
  2022-09-12 17:39 [PATCH] libstdc++: Squelch -Wparentheses warning with debug iterators Patrick Palka
@ 2022-09-13 10:47 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2022-09-13 10:47 UTC (permalink / raw)
  To: Patrick Palka; +Cc: gcc-patches, libstdc++

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
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-13 10:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-12 17:39 [PATCH] libstdc++: Squelch -Wparentheses warning with debug iterators Patrick Palka
2022-09-13 10:47 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).