git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v5 5/5] convert: add "status=delayed" to filter process protocol

From
Jeff King <peff@peff.net>
Date
Jun 24, 2017, 20:36 UTC
Message-ID
<20170624203640.qomgbsakrgseungl@sigill.intra.peff.net>
In-Reply-To
<xmqq37ap9q2i.fsf@gitster.mtv.corp.google.com>
On Sat, Jun 24, 2017 at 11:51:49AM -0700, Junio C Hamano wrote:
Show 6 quoted lines
> >>  if ((CAP_DELAY & entry->supported_capabilities) &&
> >>      dco && dco->state == CE_CAN_DELAY))
> >
> > Agreed!
> 
> Why wasn't this caught earlier?  I thought this is something gcc warns about.
I thought so, too. If it warned about:
  if (A & B)
that would probably be too annoying. But:
  if (A & B && C)

is much more questionable. I wonder if it used to exist and gcc dropped it (or dropped it from -Wall). -Wlogical-op seems like the most likely candidate, but it does not catch it (and it has a false positive in handle_nonblock, or perhaps I just can't see the problem).

Show 10 quoted lines
> >> The operator precedence is such that it works without them, so this is
> >> just a style question (I'd also usually put the flags field before the
> >> flag itself, but that's really getting into aesthetics).
> >
> > You mean (entry & CAP_DELAY) instead of (CAP_DELAY & entry)?
> 
> Peff is continuing his explanation why (A & B && C) is technically
> correct and preferring ((A & B) && C) is purely stylistic.  "A & B"
> binds tighter than "something && C" which means that (A & B && C)
> cannot be misinterpreted as (A & (B && C)).

I actually meant both. The bitwise operator binds tighter so it's OK either way. But I would write "flags & MY_FLAG" and never "MY_FLAG & flags".

-Peff
Previous: Junio C HamanoNext: Jeff King
Message 10 of 20 in “convert: add "status=delayed" to filter process protocol”
  1. 0/5 convert: add "status=delayed" to filter process protocolLars Schneider, Jun 1, 2017
  2. 1/5 t0021: keep filter log files on comparisonLars Schneider, Jun 1, 2017
  3. 2/5 t0021: make debug log file name configurableLars Schneider, Jun 1, 2017
  4. 5/5 convert: add "status=delayed" to filter process protocolLars Schneider, Jun 1, 2017
  5. Junio C HamanoJun 2, 2017
  6. Lars SchneiderJun 5, 2017
  7. Jeff KingJun 24, 2017
  8. Lars SchneiderJun 24, 2017
  9. Junio C HamanoJun 24, 2017
  10. Jeff KingJun 24, 2017
  11. Jeff KingJun 24, 2017
  12. 4/5 convert: move multiple file filter error handling to separate functionLars Schneider, Jun 1, 2017
  13. Torsten BögershausenJun 18, 2017
  14. Lars SchneiderJun 18, 2017
  15. Torsten BögershausenJun 19, 2017
  16. Lars SchneiderJun 19, 2017
  17. 3/5 t0021: write "OUT" only on successLars Schneider, Jun 1, 2017
  18. Junio C HamanoJun 1, 2017
  19. Junio C HamanoJun 2, 2017
  20. Jeff KingJun 24, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.