xref: /illumos-gate/usr/src/head/stddef.h (revision 3ce5372277f4657ad0e52d36c979527c4ca22de2)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*	Copyright (c) 1988 AT&T	*/
23 /*	  All Rights Reserved	*/
24 
25 
26 /*
27  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 #ifndef _STDDEF_H
32 #define	_STDDEF_H
33 
34 #include <sys/isa_defs.h>
35 #include <iso/stddef_iso.h>
36 #include <sys/stddef.h>
37 
38 /*
39  * Allow global visibility for symbols defined in
40  * C++ "std" namespace in <iso/stddef_iso.h>.
41  */
42 #if __cplusplus >= 199711L
43 using std::ptrdiff_t;
44 using std::size_t;
45 #endif
46 
47 #ifdef	__cplusplus
48 extern "C" {
49 #endif
50 
51 /*
52  * wchar_t is a built-in type in standard C++ and as such is not
53  * defined here when using standard C++. However, the GNU compiler
54  * fixincludes utility nonetheless creates its own version of this
55  * header for use by gcc and g++. In that version it adds a redundant
56  * guard for __cplusplus. To avoid the creation of a gcc/g++ specific
57  * header we need to include the following magic comment:
58  *
59  * we must use the C++ compiler's type
60  *
61  * The above comment should not be removed or changed until GNU
62  * gcc/fixinc/inclhack.def is updated to bypass this header.
63  */
64 #if !defined(__cplusplus) || (__cplusplus < 199711L && !defined(__GNUG__))
65 #ifndef _WCHAR_T
66 #define	_WCHAR_T
67 #if defined(_LP64)
68 typedef int	wchar_t;
69 #else
70 typedef long    wchar_t;
71 #endif
72 #endif  /* !_WCHAR_T */
73 #endif	/* !defined(__cplusplus) ... */
74 
75 #ifdef	__cplusplus
76 }
77 #endif
78 
79 #endif	/* _STDDEF_H */
80