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

Re: [PATCH] Mac OS X 10.5 does not require the OLD_ICONV flag set

From
Blake Ramsdell <blaker@gmail.com>
Date
Nov 2, 2007, 20:03 UTC
Message-ID
<985966520711021303g905f638y2056219c22e5edeb@mail.gmail.com>
In-Reply-To
<ee77f5c20711020423t6ce58818gcc5220b6427ded1@mail.gmail.com>
On 11/2/07, David Symonds <dsymonds@gmail.com> wrote:
> It would probably be most appropriate for the autoconf script. Now
> that I look at configure.ac, there's already a test for iconv in
> there; is it not used?

The crux of this problem is that the prototype for iconv in /usr/include/iconv.h is different between OS X 10.4 and OS X 10.5. So the "right thing" is definitely to determine what is in the function prototype, and then act accordingly.

>From OS X 10.4.10:

#define _LIBICONV_VERSION 0x0109 /* version number: (major<<8) + minor */ ... extern size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);

>From OS X 10.5:
#define _LIBICONV_VERSION 0x010B    /* version number: (major<<8) + minor */
...
size_t iconv (iconv_t /*cd*/,
        char ** __restrict /*inbuf*/,  size_t * __restrict /*inbytesleft*/,
        char ** __restrict /*outbuf*/, size_t * __restrict /*outbytesleft*/);

So what happened in git is that someone put in OLD_ICONV to dynamically adjust the const-ness of parameter 2 to the iconv function, and the way they chose to do that is to identify the OS (more accurately, the kernel), and then I went and furthered that by identifying the version.

Now that I look at it further, it seems that yanking OLD_ICONV altogether is a better approach, and to just check _LIBICONV_VERSION to make sure it's "new enough". Now, I'm not sure what that comparison would be, but we know that "later than 0x0109" is a good start. Based on the version difference between OS X 10.4 and 10.5 I note that there is only 0x010A intervening.

This strategy presumes that this const parameter was const all the way up to a particular point, and then stopped being const, which is probably a reasonable assumption.

Blake
-- 
Blake Ramsdell | http://www.blakeramsdell.com
Previous: David SymondsNext: Blake Ramsdell
Message 12 of 15 in “Mac OS X 10.5 does not require the OLD_ICONV flag set”
  1. Mac OS X 10.5 does not require the OLD_ICONV flag setBlake Ramsdell, Nov 2, 2007
  2. Fixed a gcc 4.0.1 complaint about an uninitialized variableBlake Ramsdell, Nov 2, 2007
  3. Junio C HamanoNov 2, 2007
  4. Junio C HamanoNov 2, 2007
  5. Blake RamsdellNov 2, 2007
  6. Mike HommeyNov 2, 2007
  7. Benoit SIGOURENov 2, 2007
  8. Mike HommeyNov 2, 2007
  9. David SymondsNov 2, 2007
  10. Junio C HamanoNov 2, 2007
  11. David SymondsNov 2, 2007
  12. Blake RamsdellNov 2, 2007
  13. Removed OLD_ICONV in favor of checking _LIBICONV_VERSION directlyBlake Ramsdell, Nov 3, 2007
  14. Junio C HamanoNov 3, 2007
  15. Blake RamsdellNov 3, 2007

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.