The spec says that FILE must be defined in wchar.h, but it wasn't. It

is now.  Also hide some macros in C++ mode that will break C++
namespaced calls.

Approved by:	dim (mentor)
This commit is contained in:
David Chisnall 2011-11-13 16:18:48 +00:00
parent eb20220e9b
commit c9e7ce2fe1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=227487
2 changed files with 28 additions and 20 deletions

View File

@ -107,7 +107,7 @@ struct __sbuf {
* inline functions. To preserve ABI compat, these members must not * inline functions. To preserve ABI compat, these members must not
* be disturbed. These members are marked below with (*). * be disturbed. These members are marked below with (*).
*/ */
typedef struct __sFILE { struct __sFILE {
unsigned char *_p; /* (*) current position in (some) buffer */ unsigned char *_p; /* (*) current position in (some) buffer */
int _r; /* (*) read space left for getc() */ int _r; /* (*) read space left for getc() */
int _w; /* (*) write space left for putc() */ int _w; /* (*) write space left for putc() */
@ -144,8 +144,11 @@ typedef struct __sFILE {
int _fl_count; /* recursive lock count */ int _fl_count; /* recursive lock count */
int _orientation; /* orientation for fwide() */ int _orientation; /* orientation for fwide() */
__mbstate_t _mbstate; /* multibyte conversion state */ __mbstate_t _mbstate; /* multibyte conversion state */
} FILE; };
#ifndef _STDFILE_DECLARED
#define _STDFILE_DECLARED
typedef struct __sFILE FILE;
#endif
#ifndef _STDSTREAM_DECLARED #ifndef _STDSTREAM_DECLARED
__BEGIN_DECLS __BEGIN_DECLS
extern FILE *__stdinp; extern FILE *__stdinp;
@ -467,6 +470,7 @@ static __inline int __sputc(int _c, FILE *_p) {
__swbuf((int)(c), p) : \ __swbuf((int)(c), p) : \
(*(p)->_p = (c), (int)*(p)->_p++)) (*(p)->_p = (c), (int)*(p)->_p++))
#endif #endif
#ifndef __cplusplus
#define __sfeof(p) (((p)->_flags & __SEOF) != 0) #define __sfeof(p) (((p)->_flags & __SEOF) != 0)
#define __sferror(p) (((p)->_flags & __SERR) != 0) #define __sferror(p) (((p)->_flags & __SERR) != 0)
@ -506,6 +510,7 @@ extern int __isthreaded;
#define getchar_unlocked() getc_unlocked(stdin) #define getchar_unlocked() getc_unlocked(stdin)
#define putchar_unlocked(x) putc_unlocked(x, stdout) #define putchar_unlocked(x) putc_unlocked(x, stdout)
#endif #endif
#endif /* __cplusplus */
__END_DECLS __END_DECLS
#endif /* !_STDIO_H_ */ #endif /* !_STDIO_H_ */

View File

@ -97,20 +97,23 @@ typedef __wint_t wint_t;
#define WEOF ((wint_t)-1) #define WEOF ((wint_t)-1)
#endif #endif
struct __sFILE; #ifndef _STDFILE_DECLARED
#define _STDFILE_DECLARED
typedef struct __sFILE FILE;
#endif
struct tm; struct tm;
__BEGIN_DECLS __BEGIN_DECLS
wint_t btowc(int); wint_t btowc(int);
wint_t fgetwc(struct __sFILE *); wint_t fgetwc(FILE *);
wchar_t * wchar_t *
fgetws(wchar_t * __restrict, int, struct __sFILE * __restrict); fgetws(wchar_t * __restrict, int, FILE * __restrict);
wint_t fputwc(wchar_t, struct __sFILE *); wint_t fputwc(wchar_t, FILE *);
int fputws(const wchar_t * __restrict, struct __sFILE * __restrict); int fputws(const wchar_t * __restrict, FILE * __restrict);
int fwide(struct __sFILE *, int); int fwide(FILE *, int);
int fwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, ...); int fwprintf(FILE * __restrict, const wchar_t * __restrict, ...);
int fwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, ...); int fwscanf(FILE * __restrict, const wchar_t * __restrict, ...);
wint_t getwc(struct __sFILE *); wint_t getwc(FILE *);
wint_t getwchar(void); wint_t getwchar(void);
size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict); size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t, size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
@ -118,13 +121,13 @@ size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
int mbsinit(const mbstate_t *); int mbsinit(const mbstate_t *);
size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
mbstate_t * __restrict); mbstate_t * __restrict);
wint_t putwc(wchar_t, struct __sFILE *); wint_t putwc(wchar_t, FILE *);
wint_t putwchar(wchar_t); wint_t putwchar(wchar_t);
int swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, int swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
...); ...);
int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...); int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
wint_t ungetwc(wint_t, struct __sFILE *); wint_t ungetwc(wint_t, FILE *);
int vfwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, int vfwprintf(FILE * __restrict, const wchar_t * __restrict,
__va_list); __va_list);
int vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, int vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
__va_list); __va_list);
@ -167,9 +170,9 @@ int wprintf(const wchar_t * __restrict, ...);
int wscanf(const wchar_t * __restrict, ...); int wscanf(const wchar_t * __restrict, ...);
#ifndef _STDSTREAM_DECLARED #ifndef _STDSTREAM_DECLARED
extern struct __sFILE *__stdinp; extern FILE *__stdinp;
extern struct __sFILE *__stdoutp; extern FILE *__stdoutp;
extern struct __sFILE *__stderrp; extern FILE *__stderrp;
#define _STDSTREAM_DECLARED #define _STDSTREAM_DECLARED
#endif #endif
@ -179,7 +182,7 @@ extern struct __sFILE *__stderrp;
#define putwchar(wc) fputwc(wc, __stdoutp) #define putwchar(wc) fputwc(wc, __stdoutp)
#if __ISO_C_VISIBLE >= 1999 #if __ISO_C_VISIBLE >= 1999
int vfwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, int vfwscanf(FILE * __restrict, const wchar_t * __restrict,
__va_list); __va_list);
int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict, int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
__va_list); __va_list);
@ -217,7 +220,7 @@ size_t wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
#endif #endif
#if __BSD_VISIBLE #if __BSD_VISIBLE
wchar_t *fgetwln(struct __sFILE * __restrict, size_t * __restrict); wchar_t *fgetwln(FILE * __restrict, size_t * __restrict);
size_t wcslcat(wchar_t *, const wchar_t *, size_t); size_t wcslcat(wchar_t *, const wchar_t *, size_t);
size_t wcslcpy(wchar_t *, const wchar_t *, size_t); size_t wcslcpy(wchar_t *, const wchar_t *, size_t);
#endif #endif