xref: /illumos-gate/usr/src/head/stddef.h (revision 89b2a9fbeabf42fa54594df0e5927bcc50a07cc9)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 #include <sys/isa_defs.h>
37 #include <iso/stddef_iso.h>
38 
39 /*
40  * Allow global visibility for symbols defined in
41  * C++ "std" namespace in <iso/stddef_iso.h>.
42  */
43 #if __cplusplus >= 199711L
44 using std::ptrdiff_t;
45 using std::size_t;
46 #endif
47 
48 #ifdef	__cplusplus
49 extern "C" {
50 #endif
51 
52 /*
53  * wchar_t is a built-in type in standard C++ and as such is not
54  * defined here when using standard C++. However, the GNU compiler
55  * fixincludes utility nonetheless creates its own version of this
56  * header for use by gcc and g++. In that version it adds a redundant
57  * guard for __cplusplus. To avoid the creation of a gcc/g++ specific
58  * header we need to include the following magic comment:
59  *
60  * we must use the C++ compiler's type
61  *
62  * The above comment should not be removed or changed until GNU
63  * gcc/fixinc/inclhack.def is updated to bypass this header.
64  */
65 #if !defined(__cplusplus) || (__cplusplus < 199711L && !defined(__GNUG__))
66 #ifndef _WCHAR_T
67 #define	_WCHAR_T
68 #if defined(_LP64)
69 typedef int	wchar_t;
70 #else
71 typedef long    wchar_t;
72 #endif
73 #endif  /* !_WCHAR_T */
74 #endif	/* !defined(__cplusplus) ... */
75 
76 #ifdef	__cplusplus
77 }
78 #endif
79 
80 #endif	/* _STDDEF_H */
81