{"thread":{"id":"28852","subject":"[PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX","startedAt":"2011-11-05T15:37:34Z","lastAt":"2011-11-06T18:21:30Z","messageCount":6,"participants":["Johannes Sixt","Nix","Junio C Hamano","Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"178903","messageId":"4EB5583E.2030306@kdbg.org","threadId":"28852","inReplyTo":null,"subject":"[PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2011-11-05T15:37:34Z","receivedAt":"2011-11-05T15:37:34Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Commit f696543d (Add strtoimax() compatibility function) introduced an\nimplementation of the function, but forgot to add a declaration.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\n git-compat-util.h |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex feb6f8e..4efef46 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -354,6 +354,8 @@ extern size_t gitstrlcpy(char *, const char *, size_t);\n #ifdef NO_STRTOUMAX\n #define strtoumax gitstrtoumax\n extern uintmax_t gitstrtoumax(const char *, char **, int);\n+#define strtoimax gitstrtoimax\n+extern intmax_t gitstrtoimax(const char *, char **, int);\n #endif\n \n #ifdef NO_STRTOK_R\n-- \n1.7.7.1.1608.gd424d\n"},{"id":"178909","messageId":"87ty6i1swh.fsf@spindle.srvr.nix","threadId":"28852","inReplyTo":"4EB5583E.2030306@kdbg.org","subject":"Re: [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX","fromName":"Nix","fromEmail":"nix@esperi.org.uk","sentAt":"2011-11-05T15:38:22Z","receivedAt":"2011-11-05T15:38:22Z","isPatch":true,"sender":{"key":"nix@esperi.org.uk","avatar":"https://avatars.githubusercontent.com/u/6503005?v=4"},"body":"On 5 Nov 2011, Johannes Sixt said:\n\n> Commit f696543d (Add strtoimax() compatibility function) introduced an\n> implementation of the function, but forgot to add a declaration.\n\nOh, my apologies. (How did my testing miss that? No -Wall, I bet.)\n\n-- \nNULL && (void)\n"},{"id":"178916","messageId":"4EB56593.6090402@kdbg.org","threadId":"28852","inReplyTo":"4EB5583E.2030306@kdbg.org","subject":"Re: [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2011-11-05T16:34:27Z","receivedAt":"2011-11-05T16:34:27Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 05.11.2011 16:37, schrieb Johannes Sixt:\n> Commit f696543d (Add strtoimax() compatibility function) introduced an\n> implementation of the function, but forgot to add a declaration.\n\nOn second thought, I'm puzzled: Without this patch and without noticing\nthe warning that strtoimax() was not declared, I had built with\nNO_STRTOUMAX on MinGW before, and the build succeeded. This means that\neven though MinGW's headers are not C99, we must have pulled in function\nstrtoimax() from somewhere. I'll investigate later this weekend.\n\nAnyway, this patch does not just add a declaration for the function, but\nalso redirects strtoimax to gitstrtoimax, which is a bit more than the\ncommit message claims. Without this patch, topic na/strtoimax should not\nbuild on a non-C99 environment. Can you verify this claim?\n\n-- Hannes\n\n> \n> Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n> ---\n>  git-compat-util.h |    2 ++\n>  1 files changed, 2 insertions(+), 0 deletions(-)\n> \n> diff --git a/git-compat-util.h b/git-compat-util.h\n> index feb6f8e..4efef46 100644\n> --- a/git-compat-util.h\n> +++ b/git-compat-util.h\n> @@ -354,6 +354,8 @@ extern size_t gitstrlcpy(char *, const char *, size_t);\n>  #ifdef NO_STRTOUMAX\n>  #define strtoumax gitstrtoumax\n>  extern uintmax_t gitstrtoumax(const char *, char **, int);\n> +#define strtoimax gitstrtoimax\n> +extern intmax_t gitstrtoimax(const char *, char **, int);\n>  #endif\n>  \n>  #ifdef NO_STRTOK_R\n"},{"id":"178954","messageId":"7vlirt7pdk.fsf@alter.siamese.dyndns.org","threadId":"28852","inReplyTo":"4EB5583E.2030306@kdbg.org","subject":"Re: [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-11-06T06:10:15Z","receivedAt":"2011-11-06T06:10:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> Commit f696543d (Add strtoimax() compatibility function) introduced an\n> implementation of the function, but forgot to add a declaration.\n>\n> Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n> ---\n\nThanks, but I think f696543d is v1.7.6 and not that patch.  I hope you do\nnot mind if I just squashed this in, instead of leaving it as a separate\npatch.\n\n>  git-compat-util.h |    2 ++\n>  1 files changed, 2 insertions(+), 0 deletions(-)\n>\n> diff --git a/git-compat-util.h b/git-compat-util.h\n> index feb6f8e..4efef46 100644\n> --- a/git-compat-util.h\n> +++ b/git-compat-util.h\n> @@ -354,6 +354,8 @@ extern size_t gitstrlcpy(char *, const char *, size_t);\n>  #ifdef NO_STRTOUMAX\n>  #define strtoumax gitstrtoumax\n>  extern uintmax_t gitstrtoumax(const char *, char **, int);\n> +#define strtoimax gitstrtoimax\n> +extern intmax_t gitstrtoimax(const char *, char **, int);\n>  #endif\n>  \n>  #ifdef NO_STRTOK_R\n"},{"id":"178956","messageId":"4EB64B04.4010101@kdbg.org","threadId":"28852","inReplyTo":"7vlirt7pdk.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2011-11-06T08:53:24Z","receivedAt":"2011-11-06T08:53:24Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 06.11.2011 07:10, schrieb Junio C Hamano:\n> Johannes Sixt <j6t@kdbg.org> writes:\n> \n>> Commit f696543d (Add strtoimax() compatibility function) introduced an\n>> implementation of the function, but forgot to add a declaration.\n>>\n>> Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n>> ---\n> \n> Thanks, but I think f696543d is v1.7.6 and not that patch.\n\nOops, sorry for that.\n\n>  I hope you do\n> not mind if I just squashed this in, instead of leaving it as a separate\n> patch.\n\nI do not mind at all.\n\n-- Hannes\n"},{"id":"178972","messageId":"4EB6D02A.4010000@ramsay1.demon.co.uk","threadId":"28852","inReplyTo":"4EB56593.6090402@kdbg.org","subject":"Re: [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2011-11-06T18:21:30Z","receivedAt":"2011-11-06T18:21:30Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Johannes Sixt wrote:\n> Am 05.11.2011 16:37, schrieb Johannes Sixt:\n>> Commit f696543d (Add strtoimax() compatibility function) introduced an\n>> implementation of the function, but forgot to add a declaration.\n> \n> On second thought, I'm puzzled: Without this patch and without noticing\n> the warning that strtoimax() was not declared, I had built with\n> NO_STRTOUMAX on MinGW before, and the build succeeded. This means that\n> even though MinGW's headers are not C99, we must have pulled in function\n> strtoimax() from somewhere. I'll investigate later this weekend.\n\nYes, I've noticed the same thing, viz:\n\n    ramsay (pu)$ find /mingw/include -type f | xargs egrep 'strto(imax|umax|ull)'\n    /mingw/include/inttypes.h:intmax_t __cdecl __MINGW_NOTHROW strtoimax (const char\n    * __restrict__ nptr,\n    /mingw/include/inttypes.h:uintmax_t __cdecl __MINGW_NOTHROW strtoumax (const cha\n    r* __restrict__ nptr,\n    /mingw/include/stdlib.h:unsigned long long  __cdecl __MINGW_NOTHROW strtoull (co\n    nst char* __restrict__, char** __restrict__, int);\n\n    ramsay (pu)$ nm /mingw/lib/libmingwex.a | egrep 'strto(imax|umax|ull)'\n    strtoimax.o:\n    00000000 T _strtoimax\n    strtoumax.o:\n    00000000 T _strtoull\n    00000000 T _strtoumax\n\n    ramsay (pu)$\n\nSo, I assume, an earlier version of MinGW did not have the inttypes.h header\nfile and the NO_STRTOUMAX etc. settings are stale; dunno ;-)\n\nIn any event, I guess an '#include <inttypes.h>' on MinGW will be part of the\nsolution. [Without breaking the MSVC build, of course; see the NO_INTTYPES_H\nmake variable.] However, I haven't given it too much thought, so take that with\na bucket of salt!\n\nNote, also, that very similar comments apply to NO_LIBGEN_H; viz:\n\n    ramsay (pu)$ find /mingw/include -type f | xargs egrep 'char \\*(dir|base)name'\n    /mingw/include/libgen.h:extern __cdecl __MINGW_NOTHROW char *basename (char *);\n    /mingw/include/libgen.h:extern __cdecl __MINGW_NOTHROW char *dirname  (char *);\n\n    ramsay (pu)$ nm /mingw/lib/libmingwex.a | egrep '(dir|base)name'\n    basename.o:\n    00000000 T _basename\n    dirname.o:\n    00000000 T _dirname\n\n    ramsay (pu)$\n\n[having said that, I have a patch that adds a compat/dirname.c and modifies\nthe existing compat/basename.c; the MinGW dirname()/basename() functions \nhave problems.]\n\nHTH\n\nATB,\nRamsay Jones\n"}]}