public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] m68k: Quiet up cppcheck warning [PR114689]
@ 2024-04-15 14:43 Jakub Jelinek
  2024-04-15 14:51 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2024-04-15 14:43 UTC (permalink / raw)
  To: Jeff Law, Andreas Schwab; +Cc: gcc-patches

Hi!

cppcheck apparently warns on the | !!sticky part of the expression and
using | (!!sticky) quiets it up (it is correct as is).
The following patch adds the ()s, and also adds them around mant >> 1 just
in case it makes it clearer to all readers that the expression is parsed
that way already.

Ok for trunk?

2024-04-15  Jakub Jelinek  <jakub@redhat.com>

	PR libgcc/114689
	* config/m68k/fpgnulib.c (__truncdfsf2): Add parentheses around
	!!sticky bitwise or operand to quiet up cppcheck.  Add parentheses
	around mant >> 1 bitwise or operand.

--- libgcc/config/m68k/fpgnulib.c.jj	2023-11-11 08:52:20.927838065 +0100
+++ libgcc/config/m68k/fpgnulib.c	2024-04-15 16:29:57.810026425 +0200
@@ -302,7 +302,7 @@ __truncdfsf2 (double a1)
   if (exp == EXPDMASK - EXCESSD + EXCESS)
     {
       exp = EXPMASK;
-      mant = mant >> 1 | (mant & 1) | !!sticky;
+      mant = (mant >> 1) | (mant & 1) | (!!sticky);
     }
   else
     {

	Jakub


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

* Re: [PATCH] m68k: Quiet up cppcheck warning [PR114689]
  2024-04-15 14:43 [PATCH] m68k: Quiet up cppcheck warning [PR114689] Jakub Jelinek
@ 2024-04-15 14:51 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2024-04-15 14:51 UTC (permalink / raw)
  To: Jakub Jelinek, Andreas Schwab; +Cc: gcc-patches



On 4/15/24 8:43 AM, Jakub Jelinek wrote:
> Hi!
> 
> cppcheck apparently warns on the | !!sticky part of the expression and
> using | (!!sticky) quiets it up (it is correct as is).
> The following patch adds the ()s, and also adds them around mant >> 1 just
> in case it makes it clearer to all readers that the expression is parsed
> that way already.
> 
> Ok for trunk?
> 
> 2024-04-15  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR libgcc/114689
> 	* config/m68k/fpgnulib.c (__truncdfsf2): Add parentheses around
> 	!!sticky bitwise or operand to quiet up cppcheck.  Add parentheses
> 	around mant >> 1 bitwise or operand.
OK
jeff


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

end of thread, other threads:[~2024-04-15 14:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-15 14:43 [PATCH] m68k: Quiet up cppcheck warning [PR114689] Jakub Jelinek
2024-04-15 14:51 ` Jeff Law

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).