git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 03/14] msvc: Fix build by adding missing INTMAX_MAX define
@ 2010-12-04 18:57 Ramsay Jones
  2010-12-09 19:19 ` Erik Faye-Lund
  0 siblings, 1 reply; 2+ messages in thread
From: Ramsay Jones @ 2010-12-04 18:57 UTC (permalink / raw
  To: Junio C Hamano; +Cc: Johannes Sixt, GIT Mailing-list


Commit c03c831 (do not depend on signed integer overflow,
05-10-2010) provokes an msvc build failure. The cause of the
failure is a missing definition of the INTMAX_MAX constant,
used in the new maximum_signed_value_of_type(a) macro, which
would normally be defined in the C99 <stdint.h> header file.

In order the fix the compilation error, we add an appropriate
definition of the INTMAX_MAX constant, along with INTMAX_MIN
and UINTMAX_MAX, to an msvc compat header file.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 compat/vcbuild/include/unistd.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h
index 2a4f276..b14fcf9 100644
--- a/compat/vcbuild/include/unistd.h
+++ b/compat/vcbuild/include/unistd.h
@@ -45,6 +45,10 @@ typedef unsigned long long uintmax_t;
 
 typedef int64_t off64_t;
 
+#define INTMAX_MIN  _I64_MIN
+#define INTMAX_MAX  _I64_MAX
+#define UINTMAX_MAX _UI64_MAX
+
 #define STDOUT_FILENO 1
 #define STDERR_FILENO 2
 
-- 
1.7.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 03/14] msvc: Fix build by adding missing INTMAX_MAX define
  2010-12-04 18:57 [PATCH 03/14] msvc: Fix build by adding missing INTMAX_MAX define Ramsay Jones
@ 2010-12-09 19:19 ` Erik Faye-Lund
  0 siblings, 0 replies; 2+ messages in thread
From: Erik Faye-Lund @ 2010-12-09 19:19 UTC (permalink / raw
  To: Ramsay Jones; +Cc: Junio C Hamano, Johannes Sixt, GIT Mailing-list

On Sat, Dec 4, 2010 at 7:57 PM, Ramsay Jones <ramsay@ramsay1.demon.co.uk> wrote:
>
> Commit c03c831 (do not depend on signed integer overflow,
> 05-10-2010) provokes an msvc build failure. The cause of the
> failure is a missing definition of the INTMAX_MAX constant,
> used in the new maximum_signed_value_of_type(a) macro, which
> would normally be defined in the C99 <stdint.h> header file.
>
> In order the fix the compilation error, we add an appropriate
> definition of the INTMAX_MAX constant, along with INTMAX_MIN
> and UINTMAX_MAX, to an msvc compat header file.
>
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> ---
>  compat/vcbuild/include/unistd.h |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h
> index 2a4f276..b14fcf9 100644
> --- a/compat/vcbuild/include/unistd.h
> +++ b/compat/vcbuild/include/unistd.h
> @@ -45,6 +45,10 @@ typedef unsigned long long uintmax_t;
>
>  typedef int64_t off64_t;
>
> +#define INTMAX_MIN  _I64_MIN
> +#define INTMAX_MAX  _I64_MAX
> +#define UINTMAX_MAX _UI64_MAX
> +
>  #define STDOUT_FILENO 1
>  #define STDERR_FILENO 2
>

Looks good. You only really need to define INTMAX_MAX, but INTMAX_MIN
and UINTMAX_MAX are nice additions for future code. I guess you
*could* have added UINTMAX_MIN for completeness, but I doubt anyone
will ever bother to use it, as it's always 0. So for what it's worth:

Acked-by: Erik Faye-Lund <kusmabite@gmail.com>

In case someone is curious of the definitions; they are documented at
http://msdn.microsoft.com/en-us/library/k15zsh48.aspx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-09 19:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-04 18:57 [PATCH 03/14] msvc: Fix build by adding missing INTMAX_MAX define Ramsay Jones
2010-12-09 19:19 ` Erik Faye-Lund

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).