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

Re: [PATCH] perf: Fix endianness argument compatibility

From
Jeff King <peff@peff.net>
Date
Apr 14, 2010, 09:52 UTC
Message-ID
<20100414095252.GA17884@coredump.intra.peff.net>
In-Reply-To
<20100414092843.GD10537@elte.hu>
On Wed, Apr 14, 2010 at 11:28:43AM +0200, Ingo Molnar wrote:
Show 12 quoted lines
> > > Parsing an option from the command line with OPT_BOOLEAN on a bool data
> > > type would not work on a big-endian machine due to the manner in which
> > > the boolean was being cast into an int and incremented. For example,
> > > running 'perf probe --list' on a PowerPC machine would fail to properly
> > > set the list_events bool and would therefore print out the usage
> > > information and terminate.
> [...]
>
> Nice fix!
> 
> Btw., perf got the option parser from the Git project - i'm wondering how the 
> Git folks solved this endianness problem?

We didn't. We pass only actual ints for the value field in all cases. We don't use C99 bools at all. We do use bit-fields, but the compiler catches the error, since OPT_BOOLEAN tries to take its address.

-Peff
Previous: Ingo MolnarNext: tip-bot for Ian Munsie
Message 2 of 5 in “Re: [PATCH] perf: Fix endianness argument compatibility”
  1. Ingo MolnarApr 14, 2010
  2. Jeff KingApr 14, 2010
  3. [tip:perf/core] perf: Fix endianness argument compatibility with OPT_BOOLEAN() and introduce OPT_INCR()tip-bot for Ian Munsie, Apr 14, 2010
  4. Erik Faye-LundApr 14, 2010
  5. Erik Faye-LundApr 14, 2010

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.