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

Re: [PATCH] block-sha1: Windows declares ntohl() in winsock2.h

From
Nicolas Pitre <nico@cam.org>
Date
Aug 20, 2009, 02:26 UTC
Message-ID
<alpine.LFD.2.00.0908192201180.6044@xanadu.home>
In-Reply-To
<XJM0H8pTiCJpryS-arPltHCHwsm0djqVixaH1NwBqT2pci2MA9karw@cipher.nrlssc.navy.mil>
On Tue, 18 Aug 2009, Brandon Casey wrote:
Show 20 quoted lines
> The SUNWspro compiler doesn't set __i386__.  Instead it sets __i386, and
> I think __x86_64 and __amd64 where appropriate.  So, compilation with
> the SUNWspro compiler on x86 is currently unaffected by these changes and
> falls back to the generic routines.
> 
> It seems that v5.10 of the compiler can grok both the __asm__ statements
> and the ({...}) naked block notation and passes all of the tests when the
> block_sha1 code is modified to add defined(__i386) to each of the macro
> statements.
> 
> The 5.8 version cannot grok the naked block, and requires spelling __asm__
> as __asm for inline assembly.  Even then it appears that there is a bug in
> the assembly that is produced (a google search told me so), so the assembly
> code does not successfully compile.
> 
> I haven't had much time to think about how or whether to address this.
> 
> Adding something like the following would get ugly real quick:
> 
>    (defined(__i386) && defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5100))

I think the best solution in this case might simply be to add something like this somewhere at the top of git-compat-util.h after the system includes:

/*
 * The SUNWspro compiler uses different symbols than gcc.
 * Let's standardize on the gcc flavor.
 */
#if defined(__i386) && !defined(__i386__)
#define __i386__
#endif
#if (defined(__x86_64) || defined(__amd64)) && !defined(__x86_64__)
#define __x86_64__
#endif
/*
 * SUNWspro from version 5.10 supports gcc extensions such as gcc's 
 * statement expressions and extended inline asm, so let's pretend...
 */
#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5100))
#define __GNUC__
#endif
Nicolas
Previous: Brandon CaseyNext: Linus Torvalds
Message 25 of 34 in “block-sha1: Windows declares ntohl() in winsock2.h”
  1. block-sha1: Windows declares ntohl() in winsock2.hJohannes Sixt, Aug 18, 2009
  2. Sebastian SchuberthAug 18, 2009
  3. Junio C HamanoAug 18, 2009
  4. Sebastian SchuberthAug 18, 2009
  5. Artur SkawinaAug 18, 2009
  6. Sebastian SchuberthAug 18, 2009
  7. Junio C HamanoAug 18, 2009
  8. Linus TorvaldsAug 18, 2009
  9. Linus TorvaldsAug 18, 2009
  10. Sebastian SchuberthAug 18, 2009
  11. Junio C HamanoAug 18, 2009
  12. Nicolas PitreAug 18, 2009
  13. Nicolas PitreAug 18, 2009
  14. Junio C HamanoAug 18, 2009
  15. Nicolas PitreAug 18, 2009
  16. Junio C HamanoAug 18, 2009
  17. Nicolas PitreAug 18, 2009
  18. make sure byte swapping is optimal for gitNicolas Pitre, Aug 18, 2009
  19. block-sha1: guard gcc extensions with __GNUC__Nicolas Pitre, Aug 18, 2009
  20. Junio C HamanoAug 18, 2009
  21. Brandon CaseyAug 18, 2009
  22. Nicolas PitreAug 18, 2009
  23. Linus TorvaldsAug 18, 2009
  24. Brandon CaseyAug 18, 2009
  25. Nicolas PitreAug 20, 2009
  26. Linus TorvaldsAug 20, 2009
  27. Brandon CaseyAug 20, 2009
  28. Sebastian SchuberthAug 18, 2009
  29. Junio C HamanoAug 18, 2009
  30. Nicolas PitreAug 18, 2009
  31. Junio C HamanoAug 18, 2009
  32. Junio C HamanoAug 18, 2009
  33. Nicolas PitreAug 18, 2009
  34. Nicolas PitreAug 18, 2009

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.