1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-25 19:11:56 +00:00
emacs/nt/inc/stdint.h
Eli Zaretskii 8c9afb4694 Fix MS-Windows build with MSVC compiler.
Parts of the changes by Fabrice Popineau  <fabrice.popineau@supelec.fr>.

 lib-src/makefile.w32-in (LOCAL_FLAGS): Add $(EMACS_EXTRA_C_FLAGS).
 lib-src/emacsclient.c (main) <environ>: Remove declaration, already
 pulled in by unistd.h on Posix hosts and stdlib.h on MS-Windows.
 nt/inc/stdint.h (uint32_t, uint64_t) [_WIN64]: New typedefs.
 (UINT64_MAX) [_WIN64]: Fix definition.
 (uintmax_t, intmax_t): Fix definitions.
 nt/inc/inttypes.h (strtoumax, strtoimax) [!__MINGW32__]: Provide
 correct definitions.
 nt/config.nt (HAVE_DECL_STRTOLL): Define.
 (va_copy) [_WIN64]: Provide a better definition.
 src/s/ms-w32.h (utimbuf) [_MSC_VER]: Don't define.
 (snprintf) [_MSC_VER]: Redirect to _snprintf.
 (strtoll) [_MSC_VER]: Redirect to _strtoi64.
 (malloc, free, realloc, calloc): Redirect to e_* only when
 compiling Emacs.
 src/lisp.h (GCTYPEBITS): Move before first use.
 (ALIGN_GCTYPEBITS) [_MSC_VER]: Define.
 (DECL_ALIGN) [_MSC_VER]: Use it, as MSVC doesn't like bit ops in
 this macro definition.
 (tzname): Redirect to _tzname for all values of _MSC_VER.

Fixes: debbugs:9960
2011-11-27 20:52:53 +02:00

67 lines
2.0 KiB
C

/* Replacement stdint.h file for building GNU Emacs on Windows.
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _NT_STDINT_H_
#define _NT_STDINT_H_
#ifdef __GNUC__
# include_next <stdint.h> /* use stdint.h if available */
#else /* !__GNUC__ */
/* Minimum definitions to allow compilation with tool chains where
stdint.h is not available, e.g. Microsoft Visual Studio. */
#ifdef _WIN64
typedef __int64 intptr_t;
typedef unsigned int uint32_t;
typedef unsigned __int64 uint64_t;
#define UINT64_MAX (18446744073709551615i64)
#define UINT64_MIN 0
/* "i64" is the non-standard suffix used by MSVC for 64-bit constants. */
#define INT64_MAX 9223372036854775807i64
#define INT64_MIN (~INT64_MAX)
#define INTPTR_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
#define UINTMAX_MIN UINT64_MIN
#define INTMAX_MAX INT64_MAX
#define INTMAX_MIN INT64_MIN
#define uintmax_t unsigned __int64
#define intmax_t __int64
#else
typedef int intptr_t;
typedef unsigned int uint32_t;
#define UINT32_MAX 4294967295
#define UINT32_MIN 0
#define INT32_MAX 2147483647
#define INT32_MIN (~INT32_MAX)
#define INTPTR_MAX INT32_MAX
#define UINTMAX_MAX UINT32_MAX
#define UINTMAX_MIN UINT32_MIN
#define INTMAX_MAX INT32_MAX
#define INTMAX_MIN INT32_MIN
#define uintmax_t unsigned long
#define intmax_t long
#endif
#define PTRDIFF_MAX INTPTR_MAX
#endif /* !__GNUC__ */
#endif /* _NT_STDINT_H_ */