newlib/winsup/mingw/include/_mingw.h

196 lines
5.1 KiB
C
Raw Normal View History

2000-02-17 20:38:33 +01:00
/*
* _mingw.h
*
* Mingw specific macros included by ALL include files.
2000-02-17 20:38:33 +01: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 16:01:06 +01:00
* DISCLAIMED. This includes but is not limited to warranties of
2000-02-17 20:38:33 +01:00
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __MINGW_H
#define __MINGW_H
#if __GNUC__ >= 3
#pragma GCC system_header
#endif
2000-02-17 20:38:33 +01:00
/* These are defined by the user (or the compiler)
to specify how identifiers are imported from a DLL.
__DECLSPEC_SUPPORTED Defined if dllimport attribute is supported.
__MINGW_IMPORT The attribute definition to specify imported
variables/functions.
_CRTIMP As above. For MS compatibility.
2000-02-17 20:38:33 +01:00
__MINGW32_VERSION Runtime version.
__MINGW32_MAJOR_VERSION Runtime major version.
__MINGW32_MINOR_VERSION Runtime minor version.
__MINGW32_BUILD_DATE Runtime build date.
2000-02-17 20:38:33 +01:00
Other macros:
__int64 define to be long long. Using a typedef doesn't
work for "unsigned __int64"
2000-02-17 20:38:33 +01: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. */
/* Try to avoid problems with outdated checks for GCC __attribute__ support. */
#undef __attribute__
2000-02-17 20:38:33 +01:00
#ifndef __GNUC__
# ifndef __MINGW_IMPORT
# define __MINGW_IMPORT __declspec(dllimport)
# endif
# ifndef _CRTIMP
# define _CRTIMP __declspec(dllimport)
# endif
2000-02-17 20:38:33 +01:00
# define __DECLSPEC_SUPPORTED
# define __attribute__(x) /* nothing */
2000-02-17 20:38:33 +01:00
#else /* __GNUC__ */
# ifdef __declspec
# ifndef __MINGW_IMPORT
/* Note the extern. This is needed to work around GCC's
2000-02-17 20:38:33 +01:00
limitations in handling dllimport attribute. */
# define __MINGW_IMPORT extern __attribute__ ((__dllimport__))
# endif
# ifndef _CRTIMP
# ifdef __USE_CRTIMP
# define _CRTIMP __attribute__ ((dllimport))
# else
# define _CRTIMP
# endif
# endif
2000-02-17 20:38:33 +01:00
# define __DECLSPEC_SUPPORTED
# else /* __declspec */
2000-02-17 20:38:33 +01:00
# undef __DECLSPEC_SUPPORTED
# undef __MINGW_IMPORT
# ifndef _CRTIMP
# define _CRTIMP
# endif
# endif /* __declspec */
/*
The next two defines can cause problems if user code adds the __cdecl attribute
like so:
void __attribute__ ((__cdecl)) foo(void);
*/
# ifndef __cdecl
# define __cdecl __attribute__ ((__cdecl__))
# endif
# ifndef __stdcall
# define __stdcall __attribute__ ((__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
2000-02-17 20:38:33 +01:00
#endif /* __GNUC__ */
#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
#ifdef __cplusplus
# define __CRT_INLINE inline
#else
# if __GNUC_STDC_INLINE__
# define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
# else
# define __CRT_INLINE extern __inline__
# endif
#endif
#ifdef __cplusplus
# define __UNUSED_PARAM(x)
#else
# ifdef __GNUC__
# define __UNUSED_PARAM(x) x __attribute__ ((__unused__))
# else
# define __UNUSED_PARAM(x) x
# endif
#endif
#ifdef __GNUC__
#define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__))
#define __MINGW_ATTRIB_CONST __attribute__ ((__const__))
#else
#define __MINGW_ATTRIB_NORETURN
#define __MINGW_ATTRIB_CONST
#endif
#if __MINGW_GNUC_PREREQ (3, 0)
#define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__))
#define __MINGW_ATTRIB_PURE __attribute__ ((__pure__))
#else
#define __MINGW_ATTRIB_MALLOC
#define __MINGW_ATTRIB_PURE
#endif
/* Attribute `nonnull' was valid as of gcc 3.3. We don't use GCC's
variadiac macro facility, because variadic macros cause syntax
errors with --traditional-cpp. */
#if __MINGW_GNUC_PREREQ (3, 3)
#define __MINGW_ATTRIB_NONNULL(arg) __attribute__ ((__nonnull__ (arg)))
#else
#define __MINGW_ATTRIB_NONNULL(arg)
#endif /* GNUC >= 3.3 */
#if __MINGW_GNUC_PREREQ (3, 1)
#define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__))
#else
#define __MINGW_ATTRIB_DEPRECATED
#endif /* GNUC >= 3.1 */
#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. */
Add prototypes for new msvcrt.dll versions * include/_mingw.h (__MSVCRT_VERSION__): Define default as 0x0600. * include/time.h (__time64_t): Add typedef. (_mktime64): Add prototype for __MSVCRT_VERSION__ >= 0x0601. (_ctime64): Likewise. (_wctime64): Likewise. (_gmtime64): Likewise. (_localtime64): Likewise. (wcsftime): Move into _WTIME_DEFINED block. Regroup non-ANSI prototypes. * include/io.h: Include <stdint.h>. (__finddata64_t): Add struct definition. (__wfinddata64_t): Likewise. (_findfirst64): Add prototype for __MSVCRT_VERSION__ >= 0x0601. (_findnext64): Likewise. (_wfindfirst64): Likewise. (_wfindnext64): Likewise. * include/sys/timeb.h (__timeb64): Add struct definition. (_ftime64): Add prototype for __MSVCRT_VERSION__ >= 0x0601. * include/sys/utime.h (__utimbuf64): Add struct definition. (_utime64): Add prototype for __MSVCRT_VERSION__ >= 0x0601. (_futime64): Likewise. (_wutime64): Likewise. * include/sys/stat.h (__stat64): Add struct definition. (_fstat64): Add prototype for __MSVCRT_VERSION__ >= 0x0601. (_stat64): Likewise. (_wstat64): Likwise. * include/sys/types.h (__time64_t): Add typedef. * include/wchar.h (__wfinddata64_t): Add structure definition. (__stat64): Likewise. (_wctime64): Add prototype for __MSVCRT_VERSION__ >= 0x0601. (_wfindfirst64): Likewise. (_wfindnext64): Likewise. (_wutime64): Likewise. (_wstat64): Likwise. * include/malloc.h (_aligned_free): Add prototype for __MSVCRT_VERSION__ >= 0x0700. (_aligned_malloc): Likewise. (_aligned_offset_malloc): Likewise. (_aligned_offset_realloc): Likewise. (_aligned_realloc): Likewise. * include/string.h (_wcserror): Add prototype for __MSVCRT_VERSION__ >= 0x0700. (__wcserror): Likewise. * include/math.h (_set_SSE2_enable): Add prototype for __MSVCRT_VERSION__ >= 0x0701.
2004-03-26 12:30:24 +01:00
#ifndef __MSVCRT_VERSION__
/* High byte is the major version, low byte is the minor. */
# define __MSVCRT_VERSION__ 0x0600
#endif
#define __MINGW32_VERSION 3.14
#define __MINGW32_MAJOR_VERSION 3
#define __MINGW32_MINOR_VERSION 14
2000-02-17 20:38:33 +01:00
#endif /* __MINGW_H */