Print this page
Fix clang errors
3781 gcc4.7 __cplusplus change incompatibility
3781 gcc4.7 __cplusplus change incompatibility
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/iso/stdlib_iso.h
+++ new/usr/src/head/iso/stdlib_iso.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 27 /* Copyright (c) 1988 AT&T */
28 28 /* All Rights Reserved */
29 29
30 30
31 31 /*
32 32 * An application should not include this header directly. Instead it
33 33 * should be included only through the inclusion of other Sun headers.
34 34 *
35 35 * The contents of this header is limited to identifiers specified in the
↓ open down ↓ |
35 lines elided |
↑ open up ↑ |
36 36 * C Standard. Any new identifiers specified in future amendments to the
37 37 * C Standard must be placed in this header. If these new identifiers
38 38 * are required to also be in the C++ Standard "std" namespace, then for
39 39 * anything other than macro definitions, corresponding "using" directives
40 40 * must also be added to <locale.h>.
41 41 */
42 42
43 43 #ifndef _ISO_STDLIB_ISO_H
44 44 #define _ISO_STDLIB_ISO_H
45 45
46 -#pragma ident "%Z%%M% %I% %E% SMI"
47 -
48 46 #include <sys/feature_tests.h>
49 47
50 48 #ifdef __cplusplus
51 49 extern "C" {
52 50 #endif
53 51
54 52 #if defined(__STDC__)
55 53 extern unsigned char __ctype[];
56 54 #define MB_CUR_MAX __ctype[520]
57 55 #else
58 56 extern unsigned char _ctype[];
59 57 #define MB_CUR_MAX _ctype[520]
60 58 #endif
61 59
62 60 #if __cplusplus >= 199711L
63 61 namespace std {
64 62 #endif
65 63
66 64 typedef struct {
67 65 int quot;
68 66 int rem;
69 67 } div_t;
70 68
71 69 typedef struct {
72 70 long quot;
73 71 long rem;
74 72 } ldiv_t;
75 73
76 74 #if !defined(_SIZE_T) || __cplusplus >= 199711L
77 75 #define _SIZE_T
78 76 #if defined(_LP64) || defined(_I32LPx)
79 77 typedef unsigned long size_t; /* size of something in bytes */
80 78 #else
81 79 typedef unsigned int size_t; /* (historical version) */
82 80 #endif
83 81 #endif /* !_SIZE_T */
84 82
85 83 #ifndef NULL
86 84 #if defined(_LP64)
87 85 #define NULL 0L
88 86 #else
89 87 #define NULL 0
90 88 #endif
91 89 #endif
92 90
93 91 #define EXIT_FAILURE 1
94 92 #define EXIT_SUCCESS 0
95 93 #define RAND_MAX 32767
96 94
97 95 /*
98 96 * wchar_t is a built-in type in standard C++ and as such is not
99 97 * defined here when using standard C++. However, the GNU compiler
100 98 * fixincludes utility nonetheless creates its own version of this
101 99 * header for use by gcc and g++. In that version it adds a redundant
102 100 * guard for __cplusplus. To avoid the creation of a gcc/g++ specific
103 101 * header we need to include the following magic comment:
104 102 *
105 103 * we must use the C++ compiler's type
106 104 *
107 105 * The above comment should not be removed or changed until GNU
108 106 * gcc/fixinc/inclhack.def is updated to bypass this header.
109 107 */
110 108 #if !defined(__cplusplus) || (__cplusplus < 199711L && !defined(__GNUG__))
111 109 #ifndef _WCHAR_T
112 110 #define _WCHAR_T
113 111 #if defined(_LP64)
114 112 typedef int wchar_t;
115 113 #else
116 114 typedef long wchar_t;
117 115 #endif
118 116 #endif /* !_WCHAR_T */
119 117 #endif /* !defined(__cplusplus) ... */
120 118
↓ open down ↓ |
63 lines elided |
↑ open up ↑ |
121 119 #if defined(__STDC__)
122 120
123 121 extern void abort(void) __NORETURN;
124 122 extern int abs(int);
125 123 extern int atexit(void (*)(void));
126 124 extern double atof(const char *);
127 125 extern int atoi(const char *);
128 126 extern long int atol(const char *);
129 127 extern void *bsearch(const void *, const void *, size_t, size_t,
130 128 int (*)(const void *, const void *));
131 -#if __cplusplus >= 199711L
129 +#if __cplusplus >= 199711L && defined(__SUNPRO_CC)
132 130 extern "C++" {
133 131 void *bsearch(const void *, const void *, size_t, size_t,
134 132 int (*)(const void *, const void *));
135 133 }
136 -#endif /* __cplusplus >= 199711L */
134 +#endif /* __cplusplus >= 199711L && defined(__SUNPRO_CC) */
137 135 extern void *calloc(size_t, size_t);
138 136 extern div_t div(int, int);
139 137 extern void exit(int)
140 138 __NORETURN;
141 139 extern void free(void *);
142 140 extern char *getenv(const char *);
143 141 extern long int labs(long);
144 142 extern ldiv_t ldiv(long, long);
145 143 extern void *malloc(size_t);
146 144 extern int mblen(const char *, size_t);
147 145 extern size_t mbstowcs(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
148 146 size_t);
149 147 extern int mbtowc(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
150 148 extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
151 -#if __cplusplus >= 199711L
149 +#if __cplusplus >= 199711L && defined(__SUNPRO_CC)
152 150 extern "C++" {
153 151 void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
154 152 }
155 -#endif /* __cplusplus >= 199711L */
153 +#endif /* __cplusplus >= 199711L && defined(__SUNPRO_CC) */
156 154 extern int rand(void);
157 155 extern void *realloc(void *, size_t);
158 156 extern void srand(unsigned int);
159 157 extern double strtod(const char *_RESTRICT_KYWD, char **_RESTRICT_KYWD);
160 158 extern long int strtol(const char *_RESTRICT_KYWD, char **_RESTRICT_KYWD, int);
161 159 extern unsigned long int strtoul(const char *_RESTRICT_KYWD,
162 160 char **_RESTRICT_KYWD, int);
163 161 extern int system(const char *);
164 162 extern int wctomb(char *, wchar_t);
165 163 extern size_t wcstombs(char *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD,
166 164 size_t);
167 165
168 166 #if __cplusplus >= 199711L
169 167 extern "C++" {
170 168 inline long abs(long _l) { return labs(_l); }
171 169 inline ldiv_t div(long _l1, long _l2) { return ldiv(_l1, _l2); }
172 170 }
173 171 #endif /* __cplusplus */
174 172
175 173 #else /* not __STDC__ */
176 174
177 175 extern void abort();
178 176 extern int abs();
179 177 extern int atexit();
180 178 extern double atof();
181 179 extern int atoi();
182 180 extern long int atol();
183 181 extern void *bsearch();
184 182 extern void *calloc();
185 183 extern div_t div();
186 184 extern void exit();
187 185 extern void free();
188 186 extern char *getenv();
189 187 extern long int labs();
190 188 extern ldiv_t ldiv();
191 189 extern void *malloc();
192 190 extern int mblen();
193 191 extern size_t mbstowcs();
194 192 extern int mbtowc();
195 193 extern void qsort();
196 194 extern int rand();
197 195 extern void *realloc();
198 196 extern void srand();
199 197 extern double strtod();
200 198 extern long int strtol();
201 199 extern unsigned long strtoul();
202 200 extern int system();
203 201 extern int wctomb();
204 202 extern size_t wcstombs();
205 203
206 204 #endif /* __STDC__ */
207 205
208 206 #if __cplusplus >= 199711L
209 207 }
210 208 #endif /* end of namespace std */
211 209
212 210 #ifdef __cplusplus
213 211 }
214 212 #endif
215 213
216 214 #endif /* _ISO_STDLIB_ISO_H */
↓ open down ↓ |
51 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX