mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 22:06:06 +00:00

Summary: This patch refactors and tries to remove as much of the Windows support headers as possible. This is needed because they currently introduce super weird include cycles and dependencies between STL and libc headers. The changes in this patch are: * remove `support/win32/support.h` completely. The required parts have either been moved into `support/win32/msvc_support.h` (for `MSVC` only helpers not needed by Clang), or directly into their respective `foo.h` headers. * Combine `locale_win32.h` and `locale_mgmt_win32.h` into a single headers, this header should only be included within `__locale` or `locale` to avoid include cycles. * Remove the unneeded parts of `limits_win32.h` and re-name it to `limits_msvc_win32.h` since it's only needed by Clang. I've tested this patch using Clang on Windows, but I suspect it might technically regress our non-existent support for MSVC. Is somebody able to double check? This refactor is needed to support upcoming fixes to `<locale>` on Windows. Reviewers: bcraig, rmaprath, compnerd, EricWF Reviewed By: EricWF Subscribers: majnemer, cfe-commits Differential Revision: https://reviews.llvm.org/D32988 llvm-svn: 302727
129 lines
3.6 KiB
C++
129 lines
3.6 KiB
C++
// -*- C++ -*-
|
|
//===---------------------------- stdio.h ---------------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
// Source Licenses. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#if defined(__need_FILE) || defined(__need___FILE)
|
|
|
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
#pragma GCC system_header
|
|
#endif
|
|
|
|
#include_next <stdio.h>
|
|
|
|
#elif !defined(_LIBCPP_STDIO_H)
|
|
#define _LIBCPP_STDIO_H
|
|
|
|
/*
|
|
stdio.h synopsis
|
|
|
|
Macros:
|
|
|
|
BUFSIZ
|
|
EOF
|
|
FILENAME_MAX
|
|
FOPEN_MAX
|
|
L_tmpnam
|
|
NULL
|
|
SEEK_CUR
|
|
SEEK_END
|
|
SEEK_SET
|
|
TMP_MAX
|
|
_IOFBF
|
|
_IOLBF
|
|
_IONBF
|
|
stderr
|
|
stdin
|
|
stdout
|
|
|
|
Types:
|
|
|
|
FILE
|
|
fpos_t
|
|
size_t
|
|
|
|
int remove(const char* filename);
|
|
int rename(const char* old, const char* new);
|
|
FILE* tmpfile(void);
|
|
char* tmpnam(char* s);
|
|
int fclose(FILE* stream);
|
|
int fflush(FILE* stream);
|
|
FILE* fopen(const char* restrict filename, const char* restrict mode);
|
|
FILE* freopen(const char* restrict filename, const char * restrict mode,
|
|
FILE * restrict stream);
|
|
void setbuf(FILE* restrict stream, char* restrict buf);
|
|
int setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size);
|
|
int fprintf(FILE* restrict stream, const char* restrict format, ...);
|
|
int fscanf(FILE* restrict stream, const char * restrict format, ...);
|
|
int printf(const char* restrict format, ...);
|
|
int scanf(const char* restrict format, ...);
|
|
int snprintf(char* restrict s, size_t n, const char* restrict format, ...); // C99
|
|
int sprintf(char* restrict s, const char* restrict format, ...);
|
|
int sscanf(const char* restrict s, const char* restrict format, ...);
|
|
int vfprintf(FILE* restrict stream, const char* restrict format, va_list arg);
|
|
int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg); // C99
|
|
int vprintf(const char* restrict format, va_list arg);
|
|
int vscanf(const char* restrict format, va_list arg); // C99
|
|
int vsnprintf(char* restrict s, size_t n, const char* restrict format, // C99
|
|
va_list arg);
|
|
int vsprintf(char* restrict s, const char* restrict format, va_list arg);
|
|
int vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99
|
|
int fgetc(FILE* stream);
|
|
char* fgets(char* restrict s, int n, FILE* restrict stream);
|
|
int fputc(int c, FILE* stream);
|
|
int fputs(const char* restrict s, FILE* restrict stream);
|
|
int getc(FILE* stream);
|
|
int getchar(void);
|
|
char* gets(char* s); // removed in C++14
|
|
int putc(int c, FILE* stream);
|
|
int putchar(int c);
|
|
int puts(const char* s);
|
|
int ungetc(int c, FILE* stream);
|
|
size_t fread(void* restrict ptr, size_t size, size_t nmemb,
|
|
FILE* restrict stream);
|
|
size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb,
|
|
FILE* restrict stream);
|
|
int fgetpos(FILE* restrict stream, fpos_t* restrict pos);
|
|
int fseek(FILE* stream, long offset, int whence);
|
|
int fsetpos(FILE*stream, const fpos_t* pos);
|
|
long ftell(FILE* stream);
|
|
void rewind(FILE* stream);
|
|
void clearerr(FILE* stream);
|
|
int feof(FILE* stream);
|
|
int ferror(FILE* stream);
|
|
void perror(const char* s);
|
|
*/
|
|
|
|
#include <__config>
|
|
|
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
#pragma GCC system_header
|
|
#endif
|
|
|
|
#include_next <stdio.h>
|
|
|
|
#ifdef __cplusplus
|
|
|
|
// snprintf
|
|
#if defined(_LIBCPP_MSVCRT)
|
|
extern "C" {
|
|
int vasprintf(char **sptr, const char *__restrict fmt, va_list ap);
|
|
int asprintf(char **sptr, const char *__restrict fmt, ...);
|
|
}
|
|
#endif
|
|
|
|
#undef getc
|
|
#undef putc
|
|
#undef clearerr
|
|
#undef feof
|
|
#undef ferror
|
|
|
|
#endif
|
|
|
|
#endif // _LIBCPP_STDIO_H
|