msvc: Fix build by adding missing INTMAX_MAX define
PATCH 3/14 msvc: Fix build by adding missing INTMAX_MAX define
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.
--- compat/vcbuild/include/unistd.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
compat/vcbuild/include/unistd.h +4 -0
@@ -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
Signature · 1 line
1.7.3
Quoted 21 lines · Ramsay Jones
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_MAXconstant, used in the newmaximum_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_MAXconstant, along withINTMAX_MINandUINTMAX_MAX, to an msvc compat header file.Signed-off-by Ramsay Jones <[email protected]>---
compat/vcbuild/include/unistd.h | 4 ++++1 files changed, 4 insertions(+), 0 deletions(-)compat/vcbuild/include/unistd.h +0
-0
compat/vcbuild/include/unistd.h typedef unsigned long long uintmax_t; · line 54
Quoted 10 lines
compat/vcbuild/include/unistd.h +4
-0@@ -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:
In case someone is curious of the definitions; they are documented at
http://msdn.microsoft.com/en-us/library/k15zsh48.aspx