VirtualBox

source: vbox/trunk/include/iprt/nocrt/compiler/gcc.h@ 76558

Last change on this file since 76558 was 76557, checked in by vboxsync, 6 years ago

include/iprt: Use IPRT_INCLUDED_ rather than _iprt_ as header guard prefix, letting scm enforce this (thereby avoiding copy&paste errors like rsa.h).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 3.2 KB
Line 
1/** @file
2 * IPRT / No-CRT - GCC specifics.
3 *
4 * A quick hack for freebsd where there are no separate location
5 * for compiler specific headers like on linux, mingw, os2, ++.
6 * This file will be cleaned up later...
7 */
8
9/*
10 * Copyright (C) 2006-2019 Oracle Corporation
11 *
12 * This file is part of VirtualBox Open Source Edition (OSE), as
13 * available from http://www.virtualbox.org. This file is free software;
14 * you can redistribute it and/or modify it under the terms of the GNU
15 * General Public License (GPL) as published by the Free Software
16 * Foundation, in version 2 as it comes in the "COPYING" file of the
17 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19 *
20 * The contents of this file may alternatively be used under the terms
21 * of the Common Development and Distribution License Version 1.0
22 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
23 * VirtualBox OSE distribution, in which case the provisions of the
24 * CDDL are applicable instead of those of the GPL.
25 *
26 * You may elect to license modified versions of this file under the
27 * terms and conditions of either the GPL or the CDDL or both.
28 */
29
30#ifndef IPRT_INCLUDED_nocrt_compiler_gcc_h
31#define IPRT_INCLUDED_nocrt_compiler_gcc_h
32#ifndef RT_WITHOUT_PRAGMA_ONCE
33# pragma once
34#endif
35
36
37/* stddef.h */
38#ifdef __PTRDIFF_TYPE__
39typedef __PTRDIFF_TYPE__ ptrdiff_t;
40#elif ARCH_BITS == 32
41typedef int32_t ptrdiff_t;
42#elif ARCH_BITS == 64
43typedef int64_t ptrdiff_t;
44#else
45# error "ARCH_BITS is undefined or incorrect."
46#endif
47#define _PTRDIFF_T_DECLARED
48
49#ifdef __SIZE_TYPE__
50typedef __SIZE_TYPE__ size_t;
51#elif ARCH_BITS == 32
52typedef uint32_t size_t;
53#elif ARCH_BITS == 64
54typedef uint64_t size_t;
55#else
56# error "ARCH_BITS is undefined or incorrect."
57#endif
58#define _SIZE_T_DECLARED
59
60#ifndef __cplusplus
61# ifdef __WCHAR_TYPE__
62typedef __WCHAR_TYPE__ wchar_t;
63# elif defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
64typedef uint16_t wchar_t;
65# else
66typedef int wchar_t;
67# endif
68# define _WCHAR_T_DECLARED
69#endif
70
71#ifdef __WINT_TYPE__
72typedef __WINT_TYPE__ wint_t;
73#else
74typedef unsigned int wint_t;
75#endif
76#define _WINT_T_DECLARED
77
78#ifndef NULL
79# ifdef __cplusplus
80# define NULL 0
81# else
82# define NULL ((void *)0)
83# endif
84#endif
85
86
87#ifndef offsetof
88# if defined(__cplusplus) && defined(__offsetof__)
89# define offsetof(type, memb)
90 (__offsetof__ (reinterpret_cast<size_t>(&reinterpret_cast<const volatile char &>(static_cast<type *>(0)->memb))) )
91# else
92# define offsetof(type, memb) ((size_t)&((type *)0)->memb)
93# endif
94#endif
95
96
97/* sys/types.h */
98#ifdef __SSIZE_TYPE__
99typedef __SSIZE_TYPE__ ssize_t;
100#elif ARCH_BITS == 32
101typedef int32_t ssize_t;
102#elif ARCH_BITS == 64
103typedef int64_t ssize_t;
104#else
105# define ARCH_BITS 123123
106# error "ARCH_BITS is undefined or incorrect."
107#endif
108#define _SSIZE_T_DECLARED
109
110
111/* stdarg.h */
112typedef __builtin_va_list va_list;
113#if __GNUC__ == 3 \
114 && __GNUC_MINOR__ == 2
115# define va_start(va, arg) __builtin_stdarg_start(va, arg)
116#else
117# define va_start(va, arg) __builtin_va_start(va, arg)
118#endif
119#define va_end(va) __builtin_va_end(va)
120#define va_arg(va, type) __builtin_va_arg(va, type)
121#define va_copy(dst, src) __builtin_va_copy(dst, src)
122
123
124#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette