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-2022 Oracle and/or its affiliates.
|
---|
11 | *
|
---|
12 | * This file is part of VirtualBox base platform packages, as
|
---|
13 | * available from https://www.virtualbox.org.
|
---|
14 | *
|
---|
15 | * This program is free software; you can redistribute it and/or
|
---|
16 | * modify it under the terms of the GNU General Public License
|
---|
17 | * as published by the Free Software Foundation, in version 3 of the
|
---|
18 | * License.
|
---|
19 | *
|
---|
20 | * This program is distributed in the hope that it will be useful, but
|
---|
21 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
23 | * General Public License for more details.
|
---|
24 | *
|
---|
25 | * You should have received a copy of the GNU General Public License
|
---|
26 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
27 | *
|
---|
28 | * The contents of this file may alternatively be used under the terms
|
---|
29 | * of the Common Development and Distribution License Version 1.0
|
---|
30 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
31 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
32 | * CDDL are applicable instead of those of the GPL.
|
---|
33 | *
|
---|
34 | * You may elect to license modified versions of this file under the
|
---|
35 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
36 | *
|
---|
37 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
38 | */
|
---|
39 |
|
---|
40 | #ifndef IPRT_INCLUDED_nocrt_compiler_gcc_h
|
---|
41 | #define IPRT_INCLUDED_nocrt_compiler_gcc_h
|
---|
42 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
43 | # pragma once
|
---|
44 | #endif
|
---|
45 |
|
---|
46 |
|
---|
47 | /* stddef.h */
|
---|
48 | #ifdef __PTRDIFF_TYPE__
|
---|
49 | typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
---|
50 | #elif ARCH_BITS == 32
|
---|
51 | typedef int32_t ptrdiff_t;
|
---|
52 | #elif ARCH_BITS == 64
|
---|
53 | typedef int64_t ptrdiff_t;
|
---|
54 | #else
|
---|
55 | # error "ARCH_BITS is undefined or incorrect."
|
---|
56 | #endif
|
---|
57 | #define _PTRDIFF_T_DECLARED
|
---|
58 |
|
---|
59 | #ifdef __SIZE_TYPE__
|
---|
60 | typedef __SIZE_TYPE__ size_t;
|
---|
61 | #elif ARCH_BITS == 32
|
---|
62 | typedef uint32_t size_t;
|
---|
63 | #elif ARCH_BITS == 64
|
---|
64 | typedef uint64_t size_t;
|
---|
65 | #else
|
---|
66 | # error "ARCH_BITS is undefined or incorrect."
|
---|
67 | #endif
|
---|
68 | #define _SIZE_T_DECLARED
|
---|
69 |
|
---|
70 | #ifndef __cplusplus
|
---|
71 | # ifdef __WCHAR_TYPE__
|
---|
72 | typedef __WCHAR_TYPE__ wchar_t;
|
---|
73 | # elif defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
|
---|
74 | typedef uint16_t wchar_t;
|
---|
75 | # else
|
---|
76 | typedef int wchar_t;
|
---|
77 | # endif
|
---|
78 | # define _WCHAR_T_DECLARED
|
---|
79 | #endif
|
---|
80 |
|
---|
81 | #ifdef __WINT_TYPE__
|
---|
82 | typedef __WINT_TYPE__ wint_t;
|
---|
83 | #else
|
---|
84 | typedef unsigned int wint_t;
|
---|
85 | #endif
|
---|
86 | #define _WINT_T_DECLARED
|
---|
87 |
|
---|
88 | #ifndef NULL
|
---|
89 | # ifdef __cplusplus
|
---|
90 | # define NULL 0
|
---|
91 | # else
|
---|
92 | # define NULL ((void *)0)
|
---|
93 | # endif
|
---|
94 | #endif
|
---|
95 |
|
---|
96 |
|
---|
97 | #ifndef offsetof
|
---|
98 | # if defined(__cplusplus) && defined(__offsetof__)
|
---|
99 | # define offsetof(type, memb)
|
---|
100 | (__offsetof__ (reinterpret_cast<size_t>(&reinterpret_cast<const volatile char &>(static_cast<type *>(0)->memb))) )
|
---|
101 | # else
|
---|
102 | # define offsetof(type, memb) ((size_t)&((type *)0)->memb)
|
---|
103 | # endif
|
---|
104 | #endif
|
---|
105 |
|
---|
106 |
|
---|
107 | /* sys/types.h */
|
---|
108 | #ifdef __SSIZE_TYPE__
|
---|
109 | typedef __SSIZE_TYPE__ ssize_t;
|
---|
110 | #elif ARCH_BITS == 32
|
---|
111 | typedef int32_t ssize_t;
|
---|
112 | #elif ARCH_BITS == 64
|
---|
113 | typedef int64_t ssize_t;
|
---|
114 | #else
|
---|
115 | # define ARCH_BITS 123123
|
---|
116 | # error "ARCH_BITS is undefined or incorrect."
|
---|
117 | #endif
|
---|
118 | #define _SSIZE_T_DECLARED
|
---|
119 |
|
---|
120 |
|
---|
121 | /* stdarg.h */
|
---|
122 | typedef __builtin_va_list va_list;
|
---|
123 | #if __GNUC__ == 3 \
|
---|
124 | && __GNUC_MINOR__ == 2
|
---|
125 | # define va_start(va, arg) __builtin_stdarg_start(va, arg)
|
---|
126 | #else
|
---|
127 | # define va_start(va, arg) __builtin_va_start(va, arg)
|
---|
128 | #endif
|
---|
129 | #define va_end(va) __builtin_va_end(va)
|
---|
130 | #define va_arg(va, type) __builtin_va_arg(va, type)
|
---|
131 | #define va_copy(dst, src) __builtin_va_copy(dst, src)
|
---|
132 |
|
---|
133 |
|
---|
134 | #endif /* !IPRT_INCLUDED_nocrt_compiler_gcc_h */
|
---|