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

Re: [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Nov 6, 2011, 18:21 UTC
Message-ID
<4EB6D02A.4010000@ramsay1.demon.co.uk>
In-Reply-To
<4EB56593.6090402@kdbg.org>
Johannes Sixt wrote:
Show 9 quoted lines
> Am 05.11.2011 16:37, schrieb Johannes Sixt:
>> Commit f696543d (Add strtoimax() compatibility function) introduced an
>> implementation of the function, but forgot to add a declaration.
> 
> On second thought, I'm puzzled: Without this patch and without noticing
> the warning that strtoimax() was not declared, I had built with
> NO_STRTOUMAX on MinGW before, and the build succeeded. This means that
> even though MinGW's headers are not C99, we must have pulled in function
> strtoimax() from somewhere. I'll investigate later this weekend.
Yes, I've noticed the same thing, viz:
    ramsay (pu)$ find /mingw/include -type f | xargs egrep 'strto(imax|umax|ull)'
    /mingw/include/inttypes.h:intmax_t __cdecl __MINGW_NOTHROW strtoimax (const char
    * __restrict__ nptr,
    /mingw/include/inttypes.h:uintmax_t __cdecl __MINGW_NOTHROW strtoumax (const cha
    r* __restrict__ nptr,
    /mingw/include/stdlib.h:unsigned long long  __cdecl __MINGW_NOTHROW strtoull (co
    nst char* __restrict__, char** __restrict__, int);
    ramsay (pu)$ nm /mingw/lib/libmingwex.a | egrep 'strto(imax|umax|ull)'
    strtoimax.o:
    00000000 T _strtoimax
    strtoumax.o:
    00000000 T _strtoull
    00000000 T _strtoumax
    ramsay (pu)$

So, I assume, an earlier version of MinGW did not have the inttypes.h header file and the NO_STRTOUMAX etc. settings are stale; dunno ;-)

In any event, I guess an '#include <inttypes.h>' on MinGW will be part of the solution. [Without breaking the MSVC build, of course; see the NO_INTTYPES_H make variable.] However, I haven't given it too much thought, so take that with a bucket of salt!

Note, also, that very similar comments apply to NO_LIBGEN_H; viz:
    ramsay (pu)$ find /mingw/include -type f | xargs egrep 'char \*(dir|base)name'
    /mingw/include/libgen.h:extern __cdecl __MINGW_NOTHROW char *basename (char *);
    /mingw/include/libgen.h:extern __cdecl __MINGW_NOTHROW char *dirname  (char *);
    ramsay (pu)$ nm /mingw/lib/libmingwex.a | egrep '(dir|base)name'
    basename.o:
    00000000 T _basename
    dirname.o:
    00000000 T _dirname
    ramsay (pu)$

[having said that, I have a patch that adds a compat/dirname.c and modifies the existing compat/basename.c; the MinGW dirname()/basename() functions have problems.]

HTH

ATB, Ramsay Jones

Previous: Johannes SixtNext: Junio C Hamano
Message 4 of 6 in “Compatibility: declare strtoimax() under NO_STRTOUMAX”
  1. Compatibility: declare strtoimax() under NO_STRTOUMAXJohannes Sixt, Nov 5, 2011
  2. NixNov 5, 2011
  3. Johannes SixtNov 5, 2011
  4. Ramsay JonesNov 6, 2011
  5. Junio C HamanoNov 6, 2011
  6. Johannes SixtNov 6, 2011

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.