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

Re: [PATCH v2] compat/bswap.h: simplify MSVC endianness detection

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 10, 2020, 17:20 UTC
Message-ID
<xmqqy2j96sd4.fsf@gitster.c.googlers.com>
In-Reply-To
<nycvar.QRO.7.76.6.2011101643460.18437@tvgsbejvaqbjf.bet>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> As a maintainer, I am less concerned about the "result today" than I am
> about keeping things easy and effortless to maintain. One of your patches
> accomplishes that. The other one made it into `next`:
> https://github.com/git/git/commit/91a67b86f77
I do not think reverting it and requeuing
https://lore.kernel.org/git/20201107221916.1428757-1-dgurney99@gmail.com/

would help future folks why we ignore _MSC_VER as any sign usable to detect endianness, so I'd prefer to see a patch *on top* of 1af265f0 (compat/bswap.h: simplify MSVC endianness detection, 2020-11-08), which is 91a67b86f77^2, that explains why we prefer to list archs explicitly in its log message, which would be the primary value of that commit.

Something along this line, perhaps?
-- >8 --
Subject: compat/bswap.h: do not assume MSVC is little-endian only

Earlier, with 1af265f0 (compat/bswap.h: simplify MSVC endianness detection, 2020-11-08), we tried to simplify endianness detection used in compat/bswap.h by assuming that any version Git compiled by MSVC (detected by _MSC_VER preprocessor macro) is meant to run on little endian boxes, as the versions of old MSVC that support m68k and MIPS do not support some C99 features used in the codebase anyway.

While it might hold true that modern versions of Windows are all little-endian, MSVC is and/or can be ported to build for big-endian boxes, so tying _MSC_VER with endianness is a bit too restrictive.

Let's go back to the old way to use _MSC_VER to learn what preprocessor macros compiler uses to tell us which arch we are building for, and list these arches that are little-endian explicitly.

... signed-off-by from you and helped-by from others ...
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
    diffstat
    patch
Previous: Johannes SchindelinNext: Junio C Hamano
Message 10 of 13 in “compat/bswap.h: Simplify MSVC endianness detection”
  1. compat/bswap.h: Simplify MSVC endianness detectionDaniel Gurney, Nov 7, 2020
  2. brian m. carlsonNov 8, 2020
  3. compat/bswap.h: simplify MSVC endianness detectionDaniel Gurney, Nov 8, 2020
  4. Jeff KingNov 10, 2020
  5. brian m. carlsonNov 10, 2020
  6. Junio C HamanoNov 10, 2020
  7. Johannes SchindelinNov 10, 2020
  8. Daniel GurneyNov 10, 2020
  9. Johannes SchindelinNov 10, 2020
  10. Junio C HamanoNov 10, 2020
  11. Junio C HamanoNov 10, 2020
  12. Johannes SchindelinNov 10, 2020
  13. Jeff KingNov 10, 2020

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.