* [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX
@ 2011-11-05 15:37 Johannes Sixt
2011-11-05 15:38 ` Nix
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Johannes Sixt @ 2011-11-05 15:37 UTC (permalink / raw)
To: Nick Alcock; +Cc: Junio C Hamano, Git Mailing List
Commit f696543d (Add strtoimax() compatibility function) introduced an
implementation of the function, but forgot to add a declaration.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
git-compat-util.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h
index feb6f8e..4efef46 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -354,6 +354,8 @@ extern size_t gitstrlcpy(char *, const char *, size_t);
#ifdef NO_STRTOUMAX
#define strtoumax gitstrtoumax
extern uintmax_t gitstrtoumax(const char *, char **, int);
+#define strtoimax gitstrtoimax
+extern intmax_t gitstrtoimax(const char *, char **, int);
#endif
#ifdef NO_STRTOK_R
--
1.7.7.1.1608.gd424d
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX
2011-11-05 15:37 [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX Johannes Sixt
@ 2011-11-05 15:38 ` Nix
2011-11-05 16:34 ` Johannes Sixt
2011-11-06 6:10 ` Junio C Hamano
2 siblings, 0 replies; 6+ messages in thread
From: Nix @ 2011-11-05 15:38 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Junio C Hamano, Git Mailing List
On 5 Nov 2011, Johannes Sixt said:
> Commit f696543d (Add strtoimax() compatibility function) introduced an
> implementation of the function, but forgot to add a declaration.
Oh, my apologies. (How did my testing miss that? No -Wall, I bet.)
--
NULL && (void)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX
2011-11-05 15:37 [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX Johannes Sixt
2011-11-05 15:38 ` Nix
@ 2011-11-05 16:34 ` Johannes Sixt
2011-11-06 18:21 ` Ramsay Jones
2011-11-06 6:10 ` Junio C Hamano
2 siblings, 1 reply; 6+ messages in thread
From: Johannes Sixt @ 2011-11-05 16:34 UTC (permalink / raw)
To: Nick Alcock; +Cc: Junio C Hamano, Git Mailing List
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.
Anyway, this patch does not just add a declaration for the function, but
also redirects strtoimax to gitstrtoimax, which is a bit more than the
commit message claims. Without this patch, topic na/strtoimax should not
build on a non-C99 environment. Can you verify this claim?
-- Hannes
>
> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
> ---
> git-compat-util.h | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/git-compat-util.h b/git-compat-util.h
> index feb6f8e..4efef46 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -354,6 +354,8 @@ extern size_t gitstrlcpy(char *, const char *, size_t);
> #ifdef NO_STRTOUMAX
> #define strtoumax gitstrtoumax
> extern uintmax_t gitstrtoumax(const char *, char **, int);
> +#define strtoimax gitstrtoimax
> +extern intmax_t gitstrtoimax(const char *, char **, int);
> #endif
>
> #ifdef NO_STRTOK_R
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX
2011-11-05 15:37 [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX Johannes Sixt
2011-11-05 15:38 ` Nix
2011-11-05 16:34 ` Johannes Sixt
@ 2011-11-06 6:10 ` Junio C Hamano
2011-11-06 8:53 ` Johannes Sixt
2 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2011-11-06 6:10 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Nick Alcock, Git Mailing List
Johannes Sixt <j6t@kdbg.org> writes:
> Commit f696543d (Add strtoimax() compatibility function) introduced an
> implementation of the function, but forgot to add a declaration.
>
> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
> ---
Thanks, but I think f696543d is v1.7.6 and not that patch. I hope you do
not mind if I just squashed this in, instead of leaving it as a separate
patch.
> git-compat-util.h | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/git-compat-util.h b/git-compat-util.h
> index feb6f8e..4efef46 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -354,6 +354,8 @@ extern size_t gitstrlcpy(char *, const char *, size_t);
> #ifdef NO_STRTOUMAX
> #define strtoumax gitstrtoumax
> extern uintmax_t gitstrtoumax(const char *, char **, int);
> +#define strtoimax gitstrtoimax
> +extern intmax_t gitstrtoimax(const char *, char **, int);
> #endif
>
> #ifdef NO_STRTOK_R
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX
2011-11-06 6:10 ` Junio C Hamano
@ 2011-11-06 8:53 ` Johannes Sixt
0 siblings, 0 replies; 6+ messages in thread
From: Johannes Sixt @ 2011-11-06 8:53 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Nick Alcock, Git Mailing List
Am 06.11.2011 07:10, schrieb Junio C Hamano:
> Johannes Sixt <j6t@kdbg.org> writes:
>
>> Commit f696543d (Add strtoimax() compatibility function) introduced an
>> implementation of the function, but forgot to add a declaration.
>>
>> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
>> ---
>
> Thanks, but I think f696543d is v1.7.6 and not that patch.
Oops, sorry for that.
> I hope you do
> not mind if I just squashed this in, instead of leaving it as a separate
> patch.
I do not mind at all.
-- Hannes
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX
2011-11-05 16:34 ` Johannes Sixt
@ 2011-11-06 18:21 ` Ramsay Jones
0 siblings, 0 replies; 6+ messages in thread
From: Ramsay Jones @ 2011-11-06 18:21 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Nick Alcock, Junio C Hamano, Git Mailing List
Johannes Sixt wrote:
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-11-06 18:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-05 15:37 [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX Johannes Sixt
2011-11-05 15:38 ` Nix
2011-11-05 16:34 ` Johannes Sixt
2011-11-06 18:21 ` Ramsay Jones
2011-11-06 6:10 ` Junio C Hamano
2011-11-06 8:53 ` Johannes Sixt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).