From 181b6d0494938ed4762cb5ce947377fd2c22a19c Mon Sep 17 00:00:00 2001 From: Danny Smith Date: Fri, 27 Sep 2002 09:32:20 +0000 Subject: * include/stdio.h: Don't include stdarg.h. (__VA_LIST): Define as __builtin_va_list or char* instead. * include/stdarg.h: #include _mingw.h. In C++, #include_next in namespace __ginclude. Push va_list into std:: if whole file is needed, else push __gnuc_va_list into global. --- winsup/mingw/ChangeLog | 9 +++++++++ winsup/mingw/include/stdarg.h | 40 ++++++++++++++++++++++++++++++++++++++++ winsup/mingw/include/stdio.h | 9 ++++----- 3 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 winsup/mingw/include/stdarg.h diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index f2a662816c3..bae6ba41ba7 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,12 @@ +2002-09-27 Danny Smith + + * include/stdio.h: Don't include stdarg.h. + (__VA_LIST): Define as __builtin_va_list or char* instead. + * include/stdarg.h: #include _mingw.h. + In C++, #include_next in namespace __ginclude. + Push va_list into std:: if whole file is needed, else + push __gnuc_va_list into global. + 2002-09-27 Danny Smith * include/wchar: #include sys/types.h in non-ANSI mode. diff --git a/winsup/mingw/include/stdarg.h b/winsup/mingw/include/stdarg.h new file mode 100644 index 00000000000..a373fb80957 --- /dev/null +++ b/winsup/mingw/include/stdarg.h @@ -0,0 +1,40 @@ +/* + * stdarg.h + * Forwarding header to get gcc's stdarg.h and keep std namespace clean + */ + +#ifndef RC_INVOKED + +#include <_mingw.h> + +#ifdef __cplusplus + +namespace __ginclude +{ + /* Include gcc's stdarg.h. */ +# include_next +} + +/* If invocation was from the user program, push va_list into std. */ +#if defined (_STDARG_H) + +__BEGIN_CSTD_NAMESPACE + using __ginclude::va_list; +__END_CSTD_NAMESPACE + +/* Otherwise inject __gnuc_va_list into global. */ + +#else + +using __ginclude::__gnuc_va_list; + +#endif /* _STDARG_H */ + +#else /* __cplusplus */ + +/* Just include gcc's stdarg.h. */ +#include_next + +#endif + +#endif /* RC_INVOKED */ diff --git a/winsup/mingw/include/stdio.h b/winsup/mingw/include/stdio.h index 042b3342b32..ebe221539ce 100644 --- a/winsup/mingw/include/stdio.h +++ b/winsup/mingw/include/stdio.h @@ -40,8 +40,6 @@ #define __need_wchar_t #define __need_wint_t #include -#define __need___va_list -#include #endif /* Not RC_INVOKED */ @@ -131,12 +129,13 @@ #ifndef RC_INVOKED -#ifdef __GNUC__ -#define __VALIST __gnuc_va_list +#ifndef __VALIST +#if defined __GNUC__ && __GNUC__ >= 3 +#define __VALIST __builtin_va_list #else #define __VALIST char* #endif - +#endif /* * The structure underlying the FILE type. * -- cgit v1.2.1