Print this page
Fix clang errors
Used Albert's patch to stdio_iso.h
Formatting issues
3781 gcc4.7 __cplusplus change incompatibility
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/iso/stdio_iso.h
+++ new/usr/src/head/iso/stdio_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 * An application should not include this header directly. Instead it
32 32 * should be included only through the inclusion of other Sun headers.
33 33 *
34 34 * The contents of this header is limited to identifiers specified in the
35 35 * C Standard. Any new identifiers specified in future amendments to the
36 36 * C Standard must be placed in this header. If these new identifiers
37 37 * are required to also be in the C++ Standard "std" namespace, then for
38 38 * anything other than macro definitions, corresponding "using" directives
↓ open down ↓ |
38 lines elided |
↑ open up ↑ |
39 39 * must also be added to <stdio.h>.
40 40 */
41 41
42 42 /*
43 43 * User-visible pieces of the ANSI C standard I/O package.
44 44 */
45 45
46 46 #ifndef _ISO_STDIO_ISO_H
47 47 #define _ISO_STDIO_ISO_H
48 48
49 -#pragma ident "%Z%%M% %I% %E% SMI"
50 -
51 49 #include <sys/feature_tests.h>
52 50 #include <sys/va_list.h>
53 51 #include <stdio_tag.h>
54 52 #include <stdio_impl.h>
55 53
56 54 /*
57 55 * If feature test macros are set that enable interfaces that use types
58 56 * defined in <sys/types.h>, get those types by doing the include.
59 57 *
60 58 * Note that in asking for the interfaces associated with this feature test
61 59 * macro one also asks for definitions of the POSIX types.
62 60 */
63 61
64 62 #ifdef __cplusplus
65 63 extern "C" {
66 64 #endif
67 65
68 66 #if !defined(_LP64) && (_FILE_OFFSET_BITS == 64 || defined(_LARGEFILE64_SOURCE))
69 67 /*
70 68 * The following typedefs are adopted from ones in <sys/types.h> (with leading
71 69 * underscores added to avoid polluting the ANSI C name space). See the
72 70 * commentary there for further explanation.
73 71 */
74 72 #if defined(_LONGLONG_TYPE)
75 73 typedef long long __longlong_t;
76 74 #else
77 75 /* used to reserve space and generate alignment */
78 76 typedef union {
79 77 double _d;
80 78 int _l[2];
81 79 } __longlong_t;
82 80 #endif
83 81 #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 || defined(_LARGEFILE64_SOURCE) */
84 82
85 83 #if __cplusplus >= 199711L
86 84 namespace std {
87 85 #endif
88 86
89 87 #if !defined(_FILEDEFED) || __cplusplus >= 199711L
90 88 #define _FILEDEFED
91 89 typedef __FILE FILE;
92 90 #endif
93 91
94 92 #if !defined(_SIZE_T) || __cplusplus >= 199711L
95 93 #define _SIZE_T
96 94 #if defined(_LP64) || defined(_I32LPx)
97 95 typedef unsigned long size_t; /* size of something in bytes */
98 96 #else
99 97 typedef unsigned int size_t; /* (historical version) */
100 98 #endif
101 99 #endif /* !_SIZE_T */
102 100
103 101 #if defined(_LP64) || _FILE_OFFSET_BITS == 32
104 102 typedef long fpos_t;
105 103 #else
106 104 typedef __longlong_t fpos_t;
107 105 #endif
108 106
109 107 #if __cplusplus >= 199711L
110 108 }
111 109 #endif /* end of namespace std */
112 110
113 111 #ifndef NULL
114 112 #if defined(_LP64)
115 113 #define NULL 0L
116 114 #else
117 115 #define NULL 0
118 116 #endif
119 117 #endif
120 118
121 119 #define BUFSIZ 1024
122 120
123 121 /*
124 122 * The value of _NFILE is defined in the Processor Specific ABI. The value
125 123 * is chosen for historical reasons rather than for truly processor related
126 124 * attribute. Note that the SPARC Processor Specific ABI uses the common
127 125 * UNIX historical value of 20 so it is allowed to fall through.
128 126 */
129 127 #if defined(__i386)
130 128 #define _NFILE 60 /* initial number of streams: Intel x86 ABI */
131 129 #else
132 130 #define _NFILE 20 /* initial number of streams: SPARC ABI and default */
133 131 #endif
134 132
135 133 #define _SBFSIZ 8 /* compatibility with shared libs */
136 134
137 135 #define _IOFBF 0000 /* full buffered */
138 136 #define _IOLBF 0100 /* line buffered */
139 137 #define _IONBF 0004 /* not buffered */
140 138 #define _IOEOF 0020 /* EOF reached on read */
141 139 #define _IOERR 0040 /* I/O error from system */
142 140
143 141 #define _IOREAD 0001 /* currently reading */
144 142 #define _IOWRT 0002 /* currently writing */
145 143 #define _IORW 0200 /* opened for reading and writing */
146 144 #define _IOMYBUF 0010 /* stdio malloc()'d buffer */
147 145
148 146 #ifndef EOF
149 147 #define EOF (-1)
150 148 #endif
151 149
152 150 #define FOPEN_MAX _NFILE
153 151 #define FILENAME_MAX 1024 /* max # of characters in a path name */
154 152
155 153 #define SEEK_SET 0
156 154 #define SEEK_CUR 1
157 155 #define SEEK_END 2
158 156 #define TMP_MAX 17576 /* 26 * 26 * 26 */
159 157
160 158 #define L_tmpnam 25 /* (sizeof(P_tmpdir) + 15) */
161 159
162 160 #if defined(__STDC__)
163 161 extern __FILE __iob[_NFILE];
164 162 #define stdin (&__iob[0])
165 163 #define stdout (&__iob[1])
166 164 #define stderr (&__iob[2])
167 165 #else
168 166 extern __FILE _iob[_NFILE];
169 167 #define stdin (&_iob[0])
170 168 #define stdout (&_iob[1])
171 169 #define stderr (&_iob[2])
172 170 #endif /* __STDC__ */
173 171
174 172 #if __cplusplus >= 199711L
175 173 namespace std {
176 174 #endif
177 175
178 176 #if !defined(_LP64) && !defined(_LONGLONG_TYPE)
179 177
180 178 #ifdef __PRAGMA_REDEFINE_EXTNAME
181 179 #pragma redefine_extname fprintf _fprintf_c89
182 180 #pragma redefine_extname printf _printf_c89
183 181 #pragma redefine_extname sprintf _sprintf_c89
184 182 #pragma redefine_extname vfprintf _vfprintf_c89
185 183 #pragma redefine_extname vprintf _vprintf_c89
186 184 #pragma redefine_extname vsprintf _vsprintf_c89
187 185 #pragma redefine_extname fscanf _fscanf_c89
188 186 #pragma redefine_extname scanf _scanf_c89
189 187 #pragma redefine_extname sscanf _sscanf_c89
190 188 #else
191 189 #define fprintf _fprintf_c89
192 190 #define printf _printf_c89
193 191 #define sprintf _sprintf_c89
194 192 #define vfprintf _vfprintf_c89
195 193 #define vprintf _vprintf_c89
196 194 #define vsprintf _vsprintf_c89
197 195 #define fscanf _fscanf_c89
198 196 #define scanf _scanf_c89
199 197 #define sscanf _sscanf_c89
200 198 #endif
201 199
202 200 #endif /* !defined(_LP64) && !defined(_LONGLONG_TYPE) */
203 201
204 202 #if defined(__STDC__)
205 203
206 204 extern int remove(const char *);
207 205 extern int rename(const char *, const char *);
208 206 extern FILE *tmpfile(void);
209 207 extern char *tmpnam(char *);
210 208 extern int fclose(FILE *);
211 209 extern int fflush(FILE *);
212 210 extern FILE *fopen(const char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
213 211 extern FILE *freopen(const char *_RESTRICT_KYWD,
214 212 const char *_RESTRICT_KYWD, FILE *_RESTRICT_KYWD);
215 213 extern void setbuf(FILE *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
216 214 extern int setvbuf(FILE *_RESTRICT_KYWD, char *_RESTRICT_KYWD, int,
217 215 size_t);
218 216 /* PRINTFLIKE2 */
219 217 extern int fprintf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...);
220 218 /* SCANFLIKE2 */
221 219 extern int fscanf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...);
222 220 /* PRINTFLIKE1 */
223 221 extern int printf(const char *_RESTRICT_KYWD, ...);
224 222 /* SCANFLIKE1 */
225 223 extern int scanf(const char *_RESTRICT_KYWD, ...);
226 224 /* PRINTFLIKE2 */
227 225 extern int sprintf(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...);
228 226 /* SCANFLIKE2 */
229 227 extern int sscanf(const char *_RESTRICT_KYWD,
230 228 const char *_RESTRICT_KYWD, ...);
231 229 extern int vfprintf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
232 230 __va_list);
233 231 extern int vprintf(const char *_RESTRICT_KYWD, __va_list);
234 232 extern int vsprintf(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
235 233 __va_list);
236 234 extern int fgetc(FILE *);
237 235 extern char *fgets(char *_RESTRICT_KYWD, int, FILE *_RESTRICT_KYWD);
238 236 extern int fputc(int, FILE *);
239 237 extern int fputs(const char *_RESTRICT_KYWD, FILE *_RESTRICT_KYWD);
240 238 #if (__cplusplus >= 199711L && (defined(_LP64) || defined(_REENTRANT))) || \
241 239 __cplusplus < 199711L
242 240 extern int getc(FILE *);
243 241 extern int putc(int, FILE *);
244 242 #endif
245 243 #if (__cplusplus >= 199711L && defined(_REENTRANT)) || \
246 244 __cplusplus < 199711L
247 245 extern int getchar(void);
248 246 extern int putchar(int);
249 247 #endif
250 248 extern char *gets(char *);
251 249 extern int puts(const char *);
252 250 extern int ungetc(int, FILE *);
253 251 extern size_t fread(void *_RESTRICT_KYWD, size_t, size_t,
254 252 FILE *_RESTRICT_KYWD);
255 253 extern size_t fwrite(const void *_RESTRICT_KYWD, size_t, size_t,
256 254 FILE *_RESTRICT_KYWD);
257 255 #if !defined(__lint) || defined(_LP64) || _FILE_OFFSET_BITS == 32
258 256 extern int fgetpos(FILE *_RESTRICT_KYWD, fpos_t *_RESTRICT_KYWD);
259 257 extern int fsetpos(FILE *, const fpos_t *);
260 258 #endif
261 259 extern int fseek(FILE *, long, int);
262 260 extern long ftell(FILE *);
263 261 extern void rewind(FILE *);
264 262 #if (__cplusplus >= 199711L && (defined(_LP64) || defined(_REENTRANT))) || \
265 263 __cplusplus < 199711L
266 264 extern void clearerr(FILE *);
267 265 extern int feof(FILE *);
268 266 extern int ferror(FILE *);
269 267 #endif
270 268 extern void perror(const char *);
271 269
272 270 #ifndef _LP64
273 271 extern int __filbuf(FILE *);
274 272 extern int __flsbuf(int, FILE *);
275 273 #endif /* _LP64 */
276 274
277 275 #else /* !defined __STDC__ */
278 276
279 277 extern int remove();
280 278 extern int rename();
281 279 extern FILE *tmpfile();
282 280 extern char *tmpnam();
283 281 extern int fclose();
284 282 extern int fflush();
285 283 extern FILE *fopen();
286 284 extern FILE *freopen();
287 285 extern void setbuf();
288 286 extern int setvbuf();
289 287 extern int fprintf();
290 288 extern int fscanf();
291 289 extern int printf();
292 290 extern int scanf();
293 291 extern int sprintf();
294 292 extern int sscanf();
295 293 extern int vfprintf();
296 294 extern int vprintf();
297 295 extern int vsprintf();
298 296 extern int fgetc();
299 297 extern char *fgets();
300 298 extern int fputc();
301 299 extern int fputs();
302 300 extern int getc();
303 301 extern int getchar();
304 302 extern char *gets();
305 303 extern int putc();
306 304 extern int putchar();
307 305 extern int puts();
308 306 extern int ungetc();
309 307 extern size_t fread();
310 308 extern size_t fwrite();
311 309 extern int fgetpos();
312 310 extern int fseek();
313 311 extern int fsetpos();
314 312 extern long ftell();
315 313 extern void rewind();
316 314 extern void clearerr();
317 315 extern int feof();
318 316 extern int ferror();
319 317 extern void perror();
320 318
321 319 #ifndef _LP64
322 320 extern int _filbuf();
323 321 extern int _flsbuf();
↓ open down ↓ |
263 lines elided |
↑ open up ↑ |
324 322 #endif /* _LP64 */
325 323
326 324 #endif /* __STDC__ */
327 325
328 326 #if __cplusplus >= 199711L
329 327 }
330 328 #endif /* end of namespace std */
331 329
332 330 #if !defined(__lint)
333 331
334 -#if !defined(_REENTRANT) && !defined(_LP64) && !defined(_STRICT_STDC)
332 +#if !defined(_REENTRANT) && !defined(_LP64)
335 333
336 334 #ifdef __STDC__
337 335 #if __cplusplus >= 199711L
338 336 namespace std {
339 337 inline int getc(FILE *_p) {
340 338 return (--_p->_cnt < 0 ? __filbuf(_p) : (int)*_p->_ptr++); }
341 339 inline int putc(int _x, FILE *_p) {
342 340 return (--_p->_cnt < 0 ? __flsbuf(_x, _p)
343 341 : (int)(*_p->_ptr++ = (unsigned char) _x)); }
344 342 }
345 343 #else /* __cplusplus >= 199711L */
↓ open down ↓ |
1 lines elided |
↑ open up ↑ |
346 344 #define getc(p) (--(p)->_cnt < 0 ? __filbuf(p) : (int)*(p)->_ptr++)
347 345 #define putc(x, p) (--(p)->_cnt < 0 ? __flsbuf((x), (p)) \
348 346 : (int)(*(p)->_ptr++ = (unsigned char) (x)))
349 347 #endif /* __cplusplus >= 199711L */
350 348 #else /* __STDC__ */
351 349 #define getc(p) (--(p)->_cnt < 0 ? _filbuf(p) : (int)*(p)->_ptr++)
352 350 #define putc(x, p) (--(p)->_cnt < 0 ? _flsbuf((x), (p)) : \
353 351 (int)(*(p)->_ptr++ = (unsigned char) (x)))
354 352 #endif /* __STDC__ */
355 353
356 -#endif /* !defined(_REENTRANT) && !defined(_LP64) && !defined(_STRICT_STDC) */
354 +#endif /* !defined(_REENTRANT) && !defined(_LP64) */
357 355
358 356 #ifndef _REENTRANT
359 357
360 358 #if __cplusplus >= 199711L
361 359 namespace std {
362 360 inline int getchar() { return getc(stdin); }
363 361 inline int putchar(int _x) { return putc(_x, stdout); }
364 362 }
365 363 #else
366 364 #define getchar() getc(stdin)
367 365 #define putchar(x) putc((x), stdout)
368 366 #endif /* __cplusplus >= 199711L */
369 367
370 368 #ifndef _LP64
371 369 #if __cplusplus >= 199711L
372 370 namespace std {
373 371 inline void clearerr(FILE *_p) { _p->_flag &= ~(_IOERR | _IOEOF); }
374 372 inline int feof(FILE *_p) { return _p->_flag & _IOEOF; }
375 373 inline int ferror(FILE *_p) { return _p->_flag & _IOERR; }
376 374 }
377 375 #else /* __cplusplus >= 199711L */
378 376 #define clearerr(p) ((void)((p)->_flag &= ~(_IOERR | _IOEOF)))
379 377 #define feof(p) ((p)->_flag & _IOEOF)
380 378 #define ferror(p) ((p)->_flag & _IOERR)
381 379 #endif /* __cplusplus >= 199711L */
382 380 #endif /* _LP64 */
383 381
384 382 #endif /* _REENTRANT */
385 383
386 384 #endif /* !defined(__lint) */
387 385
388 386 #ifdef __cplusplus
389 387 }
390 388 #endif
391 389
392 390 #endif /* _ISO_STDIO_ISO_H */
↓ open down ↓ |
26 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX