2008-08-31 01:27:18 +08:00
|
|
|
#ifndef __MINGW_H
|
2000-02-18 03:38:33 +08:00
|
|
|
/*
|
|
|
|
* _mingw.h
|
|
|
|
*
|
2006-06-26 09:41:48 +08:00
|
|
|
* Mingw specific macros included by ALL include files.
|
2000-02-18 03:38:33 +08:00
|
|
|
*
|
|
|
|
* This file is part of the Mingw32 package.
|
|
|
|
*
|
|
|
|
* Contributors:
|
|
|
|
* Created by Mumit Khan <khan@xraylith.wisc.edu>
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS NOT COPYRIGHTED
|
|
|
|
*
|
|
|
|
* This source code is offered for use in the public domain. You may
|
|
|
|
* use, modify or distribute it freely.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful but
|
|
|
|
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
2001-12-05 23:01:06 +08:00
|
|
|
* DISCLAIMED. This includes but is not limited to warranties of
|
2000-02-18 03:38:33 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#define __MINGW_H
|
|
|
|
|
2010-03-07 11:10:38 +08:00
|
|
|
#define __MINGW32_VERSION 3.18
|
2008-08-31 01:27:18 +08:00
|
|
|
#define __MINGW32_MAJOR_VERSION 3
|
2010-03-07 11:10:38 +08:00
|
|
|
#define __MINGW32_MINOR_VERSION 18
|
2009-08-15 10:50:19 +08:00
|
|
|
#define __MINGW32_PATCHLEVEL 0
|
2008-08-31 01:27:18 +08:00
|
|
|
|
2007-06-22 17:19:25 +08:00
|
|
|
#if __GNUC__ >= 3
|
|
|
|
#pragma GCC system_header
|
|
|
|
#endif
|
2006-11-09 05:58:18 +08:00
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
/* These are defined by the user (or the compiler)
|
|
|
|
to specify how identifiers are imported from a DLL.
|
|
|
|
|
2008-08-31 01:27:18 +08:00
|
|
|
__DECLSPEC_SUPPORTED Defined if dllimport attribute is supported.
|
|
|
|
__MINGW_IMPORT The attribute definition to specify imported
|
|
|
|
variables/functions.
|
|
|
|
_CRTIMP As above. For MS compatibility.
|
|
|
|
__MINGW32_VERSION Runtime version.
|
|
|
|
__MINGW32_MAJOR_VERSION Runtime major version.
|
|
|
|
__MINGW32_MINOR_VERSION Runtime minor version.
|
|
|
|
__MINGW32_BUILD_DATE Runtime build date.
|
|
|
|
|
|
|
|
Macros to enable MinGW features which deviate from standard MSVC
|
|
|
|
compatible behaviour; these may be specified directly in user code,
|
|
|
|
activated implicitly, (e.g. by specifying _POSIX_C_SOURCE or such),
|
|
|
|
or by inclusion in __MINGW_FEATURES__:
|
|
|
|
|
|
|
|
__USE_MINGW_ANSI_STDIO Select a more ANSI C99 compatible
|
|
|
|
implementation of printf() and friends.
|
2006-06-26 09:41:48 +08:00
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
Other macros:
|
|
|
|
|
2008-08-31 01:27:18 +08:00
|
|
|
__int64 define to be long long. Using a typedef
|
|
|
|
doesn't work for "unsigned __int64"
|
2006-06-26 09:41:48 +08:00
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
All headers should include this first, and then use __DECLSPEC_SUPPORTED
|
|
|
|
to choose between the old ``__imp__name'' style or __MINGW_IMPORT
|
|
|
|
style declarations. */
|
|
|
|
|
2008-08-31 01:27:18 +08:00
|
|
|
|
|
|
|
/* Manifest definitions identifying the flag bits, controlling activation
|
|
|
|
* of MinGW features, as specified by the user in __MINGW_FEATURES__.
|
|
|
|
*/
|
|
|
|
#define __MINGW_ANSI_STDIO__ 0x0000000000000001ULL
|
|
|
|
/*
|
|
|
|
* The following three are not yet formally supported; they are
|
|
|
|
* included here, to document anticipated future usage.
|
|
|
|
*/
|
|
|
|
#define __MINGW_LC_EXTENSIONS__ 0x0000000000000050ULL
|
|
|
|
#define __MINGW_LC_MESSAGES__ 0x0000000000000010ULL
|
|
|
|
#define __MINGW_LC_ENVVARS__ 0x0000000000000040ULL
|
|
|
|
|
2006-06-26 09:41:48 +08:00
|
|
|
/* Try to avoid problems with outdated checks for GCC __attribute__ support. */
|
2004-07-21 18:59:54 +08:00
|
|
|
#undef __attribute__
|
|
|
|
|
2009-07-18 22:56:47 +08:00
|
|
|
#if defined (__PCC__)
|
|
|
|
# undef __DECLSPEC_SUPPORTED
|
2002-06-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* include/_mingw.h (__MINGW_IMPORT): Check for prior definition before
defining.
* include/excpt.h (): Include windef.h not windows.h.
* include/fcntl.h (_O_SHORT_LIVED): Add define.
(_chmod): Add prototype.
(_creat): Correct prototype.
(SH_DENY*): Rename defines to _SH_DENY*.
(SH_DENY*): Add Non-ANSI names for _SH_DENY*.
include/stdio.h (_IOMYBUF, _IOEOF, _IOERR, _IOSTRG,
_IOAPPEND): Add defines.
(_wfindfirst): Correct prototype.
(_wfdopen): Add prototype.
* include/stdlib.h (_rotl, _rotr, _lrotl, _lrotr): Add
prototypes.
* include/string.h (_mbschr, _mbstok, _mbsncat): Remove
prototypes.
(_wcsdup): Correct prototype.
* include/mbstring.h: Remove comments about _mbschr, _mbstok,
_mbsncat being in string.h.
* include/wchar.h (_wfindfirst): Correct prototype.
* include/tchar.h (_tfdopen): Add _UNICODE mappings.
2002-06-18 12:13:18 +08:00
|
|
|
# ifndef __MINGW_IMPORT
|
2009-07-18 22:56:47 +08:00
|
|
|
# define __MINGW_IMPORT extern
|
2002-06-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* include/_mingw.h (__MINGW_IMPORT): Check for prior definition before
defining.
* include/excpt.h (): Include windef.h not windows.h.
* include/fcntl.h (_O_SHORT_LIVED): Add define.
(_chmod): Add prototype.
(_creat): Correct prototype.
(SH_DENY*): Rename defines to _SH_DENY*.
(SH_DENY*): Add Non-ANSI names for _SH_DENY*.
include/stdio.h (_IOMYBUF, _IOEOF, _IOERR, _IOSTRG,
_IOAPPEND): Add defines.
(_wfindfirst): Correct prototype.
(_wfdopen): Add prototype.
* include/stdlib.h (_rotl, _rotr, _lrotl, _lrotr): Add
prototypes.
* include/string.h (_mbschr, _mbstok, _mbsncat): Remove
prototypes.
(_wcsdup): Correct prototype.
* include/mbstring.h: Remove comments about _mbschr, _mbstok,
_mbsncat being in string.h.
* include/wchar.h (_wfindfirst): Correct prototype.
* include/tchar.h (_tfdopen): Add _UNICODE mappings.
2002-06-18 12:13:18 +08:00
|
|
|
# endif
|
2003-02-11 05:13:34 +08:00
|
|
|
# ifndef _CRTIMP
|
2009-07-18 22:56:47 +08:00
|
|
|
# define _CRTIMP
|
2003-02-11 05:13:34 +08:00
|
|
|
# endif
|
2009-07-18 22:56:47 +08:00
|
|
|
# ifndef __cdecl
|
|
|
|
# define __cdecl _Pragma("cdecl")
|
|
|
|
# endif
|
|
|
|
# ifndef __stdcall
|
|
|
|
# define __stdcall _Pragma("stdcall")
|
|
|
|
# endif
|
|
|
|
# ifndef __int64
|
|
|
|
# define __int64 long long
|
|
|
|
# endif
|
|
|
|
# ifndef __int32
|
|
|
|
# define __int32 long
|
|
|
|
# endif
|
|
|
|
# ifndef __int16
|
|
|
|
# define __int16 short
|
|
|
|
# endif
|
|
|
|
# ifndef __int8
|
|
|
|
# define __int8 char
|
|
|
|
# endif
|
|
|
|
# ifndef __small
|
|
|
|
# define __small char
|
|
|
|
# endif
|
|
|
|
# ifndef __hyper
|
|
|
|
# define __hyper long long
|
|
|
|
# endif
|
|
|
|
# ifndef __volatile__
|
|
|
|
# define __volatile__ volatile
|
|
|
|
# endif
|
|
|
|
# ifndef __restrict__
|
|
|
|
# define __restrict__ restrict
|
|
|
|
# endif
|
|
|
|
# define NONAMELESSUNION
|
|
|
|
#elif defined(__GNUC__)
|
2000-02-18 03:38:33 +08:00
|
|
|
# ifdef __declspec
|
2002-06-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* include/_mingw.h (__MINGW_IMPORT): Check for prior definition before
defining.
* include/excpt.h (): Include windef.h not windows.h.
* include/fcntl.h (_O_SHORT_LIVED): Add define.
(_chmod): Add prototype.
(_creat): Correct prototype.
(SH_DENY*): Rename defines to _SH_DENY*.
(SH_DENY*): Add Non-ANSI names for _SH_DENY*.
include/stdio.h (_IOMYBUF, _IOEOF, _IOERR, _IOSTRG,
_IOAPPEND): Add defines.
(_wfindfirst): Correct prototype.
(_wfdopen): Add prototype.
* include/stdlib.h (_rotl, _rotr, _lrotl, _lrotr): Add
prototypes.
* include/string.h (_mbschr, _mbstok, _mbsncat): Remove
prototypes.
(_wcsdup): Correct prototype.
* include/mbstring.h: Remove comments about _mbschr, _mbstok,
_mbsncat being in string.h.
* include/wchar.h (_wfindfirst): Correct prototype.
* include/tchar.h (_tfdopen): Add _UNICODE mappings.
2002-06-18 12:13:18 +08:00
|
|
|
# ifndef __MINGW_IMPORT
|
2002-06-13 18:20:48 +08:00
|
|
|
/* Note the extern. This is needed to work around GCC's
|
2000-02-18 03:38:33 +08:00
|
|
|
limitations in handling dllimport attribute. */
|
2006-09-11 05:16:05 +08:00
|
|
|
# define __MINGW_IMPORT extern __attribute__ ((__dllimport__))
|
2003-02-11 05:13:34 +08:00
|
|
|
# endif
|
|
|
|
# ifndef _CRTIMP
|
2003-04-01 05:11:13 +08:00
|
|
|
# ifdef __USE_CRTIMP
|
2004-07-21 18:59:54 +08:00
|
|
|
# define _CRTIMP __attribute__ ((dllimport))
|
2006-06-26 09:41:48 +08:00
|
|
|
# else
|
2003-04-01 05:11:13 +08:00
|
|
|
# define _CRTIMP
|
|
|
|
# endif
|
2003-02-11 05:13:34 +08:00
|
|
|
# endif
|
2000-02-18 03:38:33 +08:00
|
|
|
# define __DECLSPEC_SUPPORTED
|
2003-02-11 05:13:34 +08:00
|
|
|
# else /* __declspec */
|
2000-02-18 03:38:33 +08:00
|
|
|
# undef __DECLSPEC_SUPPORTED
|
|
|
|
# undef __MINGW_IMPORT
|
2003-02-11 05:13:34 +08:00
|
|
|
# ifndef _CRTIMP
|
|
|
|
# define _CRTIMP
|
|
|
|
# endif
|
|
|
|
# endif /* __declspec */
|
2007-06-22 17:19:25 +08:00
|
|
|
/*
|
2009-07-18 22:56:47 +08:00
|
|
|
* The next two defines can cause problems if user code adds the
|
|
|
|
* __cdecl attribute like so:
|
|
|
|
* void __attribute__ ((__cdecl)) foo(void);
|
|
|
|
*/
|
2007-06-22 17:19:25 +08:00
|
|
|
# ifndef __cdecl
|
|
|
|
# define __cdecl __attribute__ ((__cdecl__))
|
2003-02-11 05:13:34 +08:00
|
|
|
# endif
|
|
|
|
# ifndef __stdcall
|
2004-07-21 18:59:54 +08:00
|
|
|
# define __stdcall __attribute__ ((__stdcall__))
|
2003-02-11 05:13:34 +08:00
|
|
|
# endif
|
2003-07-01 20:57:53 +08:00
|
|
|
# ifndef __int64
|
|
|
|
# define __int64 long long
|
|
|
|
# endif
|
|
|
|
# ifndef __int32
|
|
|
|
# define __int32 long
|
|
|
|
# endif
|
|
|
|
# ifndef __int16
|
2005-01-06 19:20:51 +08:00
|
|
|
# define __int16 short
|
2003-07-01 20:57:53 +08:00
|
|
|
# endif
|
|
|
|
# ifndef __int8
|
|
|
|
# define __int8 char
|
|
|
|
# endif
|
2003-07-02 07:34:36 +08:00
|
|
|
# ifndef __small
|
|
|
|
# define __small char
|
2003-07-01 20:57:53 +08:00
|
|
|
# endif
|
2003-07-02 07:34:36 +08:00
|
|
|
# ifndef __hyper
|
|
|
|
# define __hyper long long
|
2003-07-01 20:57:53 +08:00
|
|
|
# endif
|
2009-07-18 22:56:47 +08:00
|
|
|
#else /* ! __GNUC__ && ! __PCC__ */
|
|
|
|
# ifndef __MINGW_IMPORT
|
|
|
|
# define __MINGW_IMPORT __declspec(dllimport)
|
|
|
|
# endif
|
|
|
|
# ifndef _CRTIMP
|
|
|
|
# define _CRTIMP __declspec(dllimport)
|
|
|
|
# endif
|
|
|
|
# define __DECLSPEC_SUPPORTED
|
|
|
|
# define __attribute__(x) /* nothing */
|
|
|
|
#endif
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2005-06-16 19:41:49 +08:00
|
|
|
#if defined (__GNUC__) && defined (__GNUC_MINOR__)
|
|
|
|
#define __MINGW_GNUC_PREREQ(major, minor) \
|
|
|
|
(__GNUC__ > (major) \
|
|
|
|
|| (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
|
|
|
|
#else
|
|
|
|
#define __MINGW_GNUC_PREREQ(major, minor) 0
|
|
|
|
#endif
|
|
|
|
|
2006-11-09 05:58:18 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
# define __CRT_INLINE inline
|
|
|
|
#else
|
2007-03-22 17:43:48 +08:00
|
|
|
# if __GNUC_STDC_INLINE__
|
2007-01-26 08:20:14 +08:00
|
|
|
# define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
|
2006-11-09 05:58:18 +08:00
|
|
|
# else
|
|
|
|
# define __CRT_INLINE extern __inline__
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2010-02-14 Roumen Petrov <rumen@users.sourceforge.net>
Issue [2134161]: time64 functions and types for msvcrt >= 8.0
(initial implementation)
* new type: __time32_t
* new structures: _finddata32_t, _finddata32i64_t, _finddata64i32_t,
__stat32, _stat32i64, _stat64i32, __timeb32, __utimbuf32,
__wfinddata32_t, _wfinddata32i64_t, _wfinddata64i32_t
* new functions: _ctime32, _difftime32, _difftime64, _findfirst32
_findfirst32i64, _findfirst64i32, _findnext32, _findnext32i64,
_findnext64i32, _fstat32, _fstat32i64, _fstat64i32, _ftime32,
_futime32, _gmtime32, _localtime32, _mkgmtime32, _mkgmtime64,
_mktime32, _stat32, _stat32i64, _stat64i32, _time32, _utime32,
_wctime32, _wfindfirst32, _wfindfirst32i64, _wfindfirst64i32,
_wfindnext32, _wfindnext32i64, _wfindnext64i32, _wstat32,
_wstat32i64, _wstat64i32,_wutime32
* new define _USE_32BIT_TIME_T set 32 or 64 aliases for: time_t,
ctime, difftime, _findfirst, _findfirsti64, _findnext, _findnexti64,
_fstat, _fstati64, _ftime, _futime, gmtime, localtime, mktime,
_stat, _stati64, time, _utime, _wctime, _wfindfirst, _wfindfirsti64,
_wfindnext, _wfindnexti64, _wstat, _wstati64, _wutime
2010-02-17 10:41:06 +08:00
|
|
|
# ifdef __GNUC__
|
|
|
|
# define _CRTALIAS __CRT_INLINE __attribute__ ((__always_inline__))
|
|
|
|
# else
|
|
|
|
# define _CRTALIAS __CRT_INLINE
|
|
|
|
# endif
|
|
|
|
|
2004-02-21 15:21:36 +08:00
|
|
|
#ifdef __cplusplus
|
2006-06-26 09:41:48 +08:00
|
|
|
# define __UNUSED_PARAM(x)
|
|
|
|
#else
|
2004-02-21 15:21:36 +08:00
|
|
|
# ifdef __GNUC__
|
2004-07-21 18:59:54 +08:00
|
|
|
# define __UNUSED_PARAM(x) x __attribute__ ((__unused__))
|
2004-02-21 15:21:36 +08:00
|
|
|
# else
|
|
|
|
# define __UNUSED_PARAM(x) x
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2004-07-21 18:59:54 +08:00
|
|
|
#ifdef __GNUC__
|
2004-07-26 17:13:42 +08:00
|
|
|
#define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__))
|
|
|
|
#define __MINGW_ATTRIB_CONST __attribute__ ((__const__))
|
2004-07-21 18:59:54 +08:00
|
|
|
#else
|
2004-07-26 17:13:42 +08:00
|
|
|
#define __MINGW_ATTRIB_NORETURN
|
|
|
|
#define __MINGW_ATTRIB_CONST
|
2004-07-21 18:59:54 +08:00
|
|
|
#endif
|
|
|
|
|
2005-06-16 19:41:49 +08:00
|
|
|
#if __MINGW_GNUC_PREREQ (3, 0)
|
2004-07-26 17:13:42 +08:00
|
|
|
#define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__))
|
|
|
|
#define __MINGW_ATTRIB_PURE __attribute__ ((__pure__))
|
2004-07-21 18:59:54 +08:00
|
|
|
#else
|
2004-07-26 17:13:42 +08:00
|
|
|
#define __MINGW_ATTRIB_MALLOC
|
|
|
|
#define __MINGW_ATTRIB_PURE
|
2004-07-21 18:59:54 +08:00
|
|
|
#endif
|
|
|
|
|
2005-05-02 16:03:34 +08:00
|
|
|
/* Attribute `nonnull' was valid as of gcc 3.3. We don't use GCC's
|
2005-06-06 16:21:53 +08:00
|
|
|
variadiac macro facility, because variadic macros cause syntax
|
2005-05-02 16:03:34 +08:00
|
|
|
errors with --traditional-cpp. */
|
2005-06-16 19:41:49 +08:00
|
|
|
#if __MINGW_GNUC_PREREQ (3, 3)
|
2005-05-02 16:03:34 +08:00
|
|
|
#define __MINGW_ATTRIB_NONNULL(arg) __attribute__ ((__nonnull__ (arg)))
|
2005-03-31 18:00:26 +08:00
|
|
|
#else
|
2005-05-02 16:03:34 +08:00
|
|
|
#define __MINGW_ATTRIB_NONNULL(arg)
|
2005-03-31 18:00:26 +08:00
|
|
|
#endif /* GNUC >= 3.3 */
|
|
|
|
|
2006-09-11 05:16:05 +08:00
|
|
|
#if __MINGW_GNUC_PREREQ (3, 1)
|
|
|
|
#define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__))
|
|
|
|
#else
|
|
|
|
#define __MINGW_ATTRIB_DEPRECATED
|
|
|
|
#endif /* GNUC >= 3.1 */
|
2007-06-22 17:19:25 +08:00
|
|
|
|
|
|
|
#if __MINGW_GNUC_PREREQ (3, 3)
|
|
|
|
#define __MINGW_NOTHROW __attribute__ ((__nothrow__))
|
|
|
|
#else
|
|
|
|
#define __MINGW_NOTHROW
|
|
|
|
#endif /* GNUC >= 3.3 */
|
|
|
|
|
|
|
|
|
|
|
|
/* TODO: Mark (almost) all CRT functions as __MINGW_NOTHROW. This will
|
|
|
|
allow GCC to optimize away some EH unwind code, at least in DW2 case. */
|
2006-09-11 05:16:05 +08:00
|
|
|
|
2004-03-26 19:30:24 +08:00
|
|
|
#ifndef __MSVCRT_VERSION__
|
|
|
|
/* High byte is the major version, low byte is the minor. */
|
|
|
|
# define __MSVCRT_VERSION__ 0x0600
|
|
|
|
#endif
|
|
|
|
|
2008-08-31 01:27:18 +08:00
|
|
|
/* Activation of MinGW specific extended features:
|
|
|
|
*/
|
|
|
|
#ifndef __USE_MINGW_ANSI_STDIO
|
|
|
|
/*
|
|
|
|
* If user didn't specify it explicitly...
|
|
|
|
*/
|
|
|
|
# if defined __STRICT_ANSI__ || defined _ISOC99_SOURCE \
|
|
|
|
|| defined _POSIX_SOURCE || defined _POSIX_C_SOURCE \
|
|
|
|
|| defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED \
|
|
|
|
|| defined _GNU_SOURCE || defined _BSD_SOURCE \
|
|
|
|
|| defined _SVID_SOURCE
|
|
|
|
/*
|
|
|
|
* but where any of these source code qualifiers are specified,
|
|
|
|
* then assume ANSI I/O standards are preferred over Microsoft's...
|
|
|
|
*/
|
|
|
|
# define __USE_MINGW_ANSI_STDIO 1
|
|
|
|
# else
|
|
|
|
/*
|
|
|
|
* otherwise use whatever __MINGW_FEATURES__ specifies...
|
|
|
|
*/
|
|
|
|
# define __USE_MINGW_ANSI_STDIO (__MINGW_FEATURES__ & __MINGW_ANSI_STDIO__)
|
|
|
|
# endif
|
|
|
|
#endif
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
#endif /* __MINGW_H */
|