blob: 3b560369f326f5459441236c6c525916bf253351 [file] [log] [blame]
Daniel Dunbar67588922011-11-16 22:40:57 +00001/* ===-- stdio.h - stub SDK header for compiler-rt --------------------------===
2 *
3 * The LLVM Compiler Infrastructure
4 *
5 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
7 *
8 * ===-----------------------------------------------------------------------===
9 *
10 * This is a stub SDK header file. This file is not part of the interface of
11 * this library nor an official version of the appropriate SDK header. It is
12 * intended only to stub the features of this header required by compiler-rt.
13 *
14 * ===-----------------------------------------------------------------------===
15 */
16
17#ifndef __STDIO_H__
18#define __STDIO_H__
19
20typedef struct __sFILE FILE;
21typedef __SIZE_TYPE__ size_t;
22
23/* Determine the appropriate fopen() and fwrite() functions. */
24#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
25# if defined(__i386)
26# define __FOPEN_NAME "_fopen$UNIX2003"
27# define __FWRITE_NAME "_fwrite$UNIX2003"
28# elif defined(__x86_64__)
29# define __FOPEN_NAME "_fopen"
30# define __FWRITE_NAME "_fwrite"
31# elif defined(__arm)
32# define __FOPEN_NAME "_fopen"
33# define __FWRITE_NAME "_fwrite"
34# else
35# error "unrecognized architecture for targetting OS X"
36# endif
37#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
38# if defined(__i386) || defined (__x86_64)
39# define __FOPEN_NAME "_fopen"
40# define __FWRITE_NAME "_fwrite"
41# elif defined(__arm)
42# define __FOPEN_NAME "_fopen"
43# define __FWRITE_NAME "_fwrite"
44# else
45# error "unrecognized architecture for targetting iOS"
46# endif
47#else
48# error "unrecognized architecture for targetting Darwin"
49#endif
50
51# define stderr __stderrp
52extern FILE *__stderrp;
53
54int fclose(FILE *);
55int fflush(FILE *);
56FILE *fopen(const char * restrict, const char * restrict) __asm(__FOPEN_NAME);
57int fprintf(FILE * restrict, const char * restrict, ...);
58size_t fwrite(const void * restrict, size_t, size_t, FILE * restrict)
59 __asm(__FWRITE_NAME);
60
61#endif /* __STDIO_H__ */