From 9ac413123daf6e8aea056d62c5069b90f10a26fd Mon Sep 17 00:00:00 2001 From: Danny Smith Date: Wed, 17 Apr 2002 05:37:06 +0000 Subject: [PATCH] * Makefile.in (INCLUDES): Add "-iwithprefixbefore include" to ensure gcc include dir is searched despite -nostdinc. * profile/Makefile.in (INCLUDES): Likewise. * mingwex/Makefile.in (INCLUDES): Likewise. * include/stdarg.h: Replace with stub that just guards the real gcc system header with #ifndef RCINVOKED * include/varargs.h: Likewise. * include/stddef.h: Likewise. * include/stdio.h: Include stdarg.h after defining __need___va_list. (__VALIST): Define as __gnuc_va_list if __GNUC__, else char*. Replace va_list with __VALIST throughout. --- winsup/mingw/ChangeLog | 15 ++ winsup/mingw/Makefile.in | 3 +- winsup/mingw/include/stdarg.h | 111 +-------- winsup/mingw/include/stddef.h | 372 +------------------------------ winsup/mingw/include/stdio.h | 43 ++-- winsup/mingw/include/varargs.h | 101 +-------- winsup/mingw/mingwex/Makefile.in | 3 +- winsup/mingw/profile/Makefile.in | 3 +- 8 files changed, 49 insertions(+), 602 deletions(-) diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index cdfe46e54..8d1fdb065 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,18 @@ +2002-04-17 Danny Smith + + * Makefile.in (INCLUDES): Add "-iwithprefixbefore include" to + ensure gcc include dir is searched despite -nostdinc. + * profile/Makefile.in (INCLUDES): Likewise. + * mingwex/Makefile.in (INCLUDES): Likewise. + * include/stdarg.h: Replace with stub that just guards the + real gcc system header with #ifndef RCINVOKED + * include/varargs.h: Likewise. + * include/stddef.h: Likewise. + * include/stdio.h: Include stdarg.h after defining + __need___va_list. + (__VALIST): Define as __gnuc_va_list if __GNUC__, else char*. + Replace va_list with __VALIST throughout. + 2002-04-17 Danny Smith * crt1.c: Revert changes of 2002-04-16. Use _fpreset again. diff --git a/winsup/mingw/Makefile.in b/winsup/mingw/Makefile.in index 1f9234486..6c81ba8f7 100644 --- a/winsup/mingw/Makefile.in +++ b/winsup/mingw/Makefile.in @@ -96,7 +96,8 @@ LIBM_A=@LIBM_A@ INCLUDES = -I$(srcdir)/include -I$(srcdir)/../w32api/include \ -I$(srcdir)/../include \ - -nostdinc -nostdinc++ + -nostdinc -nostdinc++ \ + -iwithprefixbefore include ALL_CFLAGS = $(CFLAGS) $(INCLUDES) $(MNO_CYGWIN) ALL_CXXFLAGS = $(CXXFLAGS) $(INCLUDES) $(MNO_CYGWIN) diff --git a/winsup/mingw/include/stdarg.h b/winsup/mingw/include/stdarg.h index 20169a1fc..90a2d95a0 100644 --- a/winsup/mingw/include/stdarg.h +++ b/winsup/mingw/include/stdarg.h @@ -1,112 +1,7 @@ /* - * stdarg.h - * - * Provides facilities for stepping through a list of function arguments of - * an unknown number and type. - * - * NOTE: Gcc should provide stdarg.h, and I believe their version will work - * with crtdll. If necessary I think you can replace this with the GCC - * stdarg.h. - * - * Note that the type used in va_arg is supposed to match the actual type - * *after default promotions*. Thus, va_arg (..., short) is not valid. - * - * This file is part of the Mingw32 package. - * - * Contributors: - * Created by Colin Peters - * - * THIS SOFTWARE IS NOT COPYRIGHTED - * - * This source code is offered for use in the public domain. You may - * use, modify or distribute it freely. - * - * This code is distributed in the hope that it will be useful but - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAIMED. This includes but is not limited to warranties of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * $Revision$ - * $Author$ - * $Date$ - * - */ - -#ifndef _STDARG_H_ -#define _STDARG_H_ - -/* All the headers include this file. */ -#include <_mingw.h> - -/* - * Don't do any of this stuff for the resource compiler. + * This is just an RC_INVOKED guard for the real stdarg.h + * fixincluded in gcc system dir. One day we will delete this file. */ #ifndef RC_INVOKED - -/* - * I was told that Win NT likes this. - */ -#ifndef _VA_LIST_DEFINED -#define _VA_LIST_DEFINED -#endif - -#ifndef _VA_LIST -#define _VA_LIST -#if defined __GNUC__ && __GNUC__ >= 3 -typedef __builtin_va_list va_list; -#else -typedef char* va_list; -#endif -#endif - -/* - * Amount of space required in an argument list (ie. the stack) for an - * argument of type t. - */ -#define __va_argsiz(t) \ - (((sizeof(t) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) - - -/* - * Start variable argument list processing by setting AP to point to the - * argument after pN. - */ -#ifdef __GNUC__ -/* - * In GNU the stack is not necessarily arranged very neatly in order to - * pack shorts and such into a smaller argument list. Fortunately a - * neatly arranged version is available through the use of __builtin_next_arg. - */ -#define va_start(ap, pN) \ - ((ap) = ((va_list) __builtin_next_arg(pN))) -#else -/* - * For a simple minded compiler this should work (it works in GNU too for - * vararg lists that don't follow shorts and such). - */ -#define va_start(ap, pN) \ - ((ap) = ((va_list) (&pN) + __va_argsiz(pN))) +#include_next #endif - - -/* - * End processing of variable argument list. In this case we do nothing. - */ -#define va_end(ap) ((void)0) - - -/* - * Increment ap to the next argument in the list while returing a - * pointer to what ap pointed to first, which is of type t. - * - * We cast to void* and then to t* because this avoids a warning about - * increasing the alignment requirement. - */ - -#define va_arg(ap, t) \ - (((ap) = (ap) + __va_argsiz(t)), \ - *((t*) (void*) ((ap) - __va_argsiz(t)))) - -#endif /* Not RC_INVOKED */ - -#endif /* not _STDARG_H_ */ diff --git a/winsup/mingw/include/stddef.h b/winsup/mingw/include/stddef.h index 7bdc2cfd0..ef9d5ffe4 100644 --- a/winsup/mingw/include/stddef.h +++ b/winsup/mingw/include/stddef.h @@ -1,373 +1,7 @@ /* - * stddef.h - * - * Standard type definitions provided by the C library. - * - * NOTE: This is typically supplied by GCC, but there's a small gotcha - - * GCC's version doesn't guard typedefs via RC_INVOKED. This is - * GCC's version, with the guard macro. Since we install this in - * the tool include directory, it gets picked up before GCC's - * internal include directory, and we're safe. - * - * This file is part of the Mingw32 package. - * - * Contributors: - * Created by Colin Peters - * - * THIS SOFTWARE IS NOT COPYRIGHTED - * - * This source code is offered for use in the public domain. You may - * use, modify or distribute it freely. - * - * This code is distributed in the hope that it will be useful but - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAIMED. This includes but is not limited to warranties of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * + * This is just an RC_INVOKED guard for the real stddef.h + * fixincluded in gcc system dir. One day we will delete this file. */ - -#if (!defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \ - && !defined(__STDDEF_H__)) \ - || defined(__need_wchar_t) || defined(__need_size_t) \ - || defined(__need_ptrdiff_t) || defined(__need_NULL) \ - || defined(__need_wint_t) - -/* Any one of these symbols __need_* means that GNU libc - wants us just to define one data type. So don't define - the symbols that indicate this file's entire job has been done. */ -#if (!defined(__need_wchar_t) && !defined(__need_size_t) \ - && !defined(__need_ptrdiff_t) && !defined(__need_NULL) \ - && !defined(__need_wint_t)) -#define _STDDEF_H -#define _STDDEF_H_ -/* snaroff@next.com says the NeXT needs this. */ -#define _ANSI_STDDEF_H -/* Irix 5.1 needs this. */ -#define __STDDEF_H__ -#endif - #ifndef RC_INVOKED - -#ifndef __sys_stdtypes_h -/* This avoids lossage on SunOS but only if stdtypes.h comes first. - There's no way to win with the other order! Sun lossage. */ - -/* On 4.3bsd-net2, make sure ansi.h is included, so we have - one less case to deal with in the following. */ -#if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__) || defined(__NetBSD__) -#include -#endif - -/* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are - defined if the corresponding type is *not* defined. - FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_ */ -#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) -#if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_) -#define _SIZE_T -#endif -#if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_) -#define _PTRDIFF_T -#endif -/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_ - instead of _WCHAR_T_. */ -#if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_) -#ifndef _BSD_WCHAR_T_ -#define _WCHAR_T -#endif -#endif -/* Undef _FOO_T_ if we are supposed to define foo_t. */ -#if defined (__need_ptrdiff_t) || defined (_STDDEF_H_) -#undef _PTRDIFF_T_ -#undef _BSD_PTRDIFF_T_ -#endif -#if defined (__need_size_t) || defined (_STDDEF_H_) -#undef _SIZE_T_ -#undef _BSD_SIZE_T_ -#endif -#if defined (__need_wchar_t) || defined (_STDDEF_H_) -#undef _WCHAR_T_ -#undef _BSD_WCHAR_T_ -#endif -#endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */ - -/* Sequent's header files use _PTRDIFF_T_ in some conflicting way. - Just ignore it. */ -#if defined (__sequent__) && defined (_PTRDIFF_T_) -#undef _PTRDIFF_T_ -#endif - -/* On VxWorks, may have defined macros like - _TYPE_size_t which will typedef size_t. fixincludes patched the - vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is - not defined, and so that defining this macro defines _GCC_SIZE_T. - If we find that the macros are still defined at this point, we must - invoke them so that the type is defined as expected. */ -#if defined (_TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_)) -_TYPE_ptrdiff_t; -#undef _TYPE_ptrdiff_t -#endif -#if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_)) -_TYPE_size_t; -#undef _TYPE_size_t -#endif -#if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_)) -_TYPE_wchar_t; -#undef _TYPE_wchar_t -#endif - -/* In case nobody has defined these types, but we aren't running under - GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and - __WCHAR_TYPE__ have reasonable values. This can happen if the - parts of GCC is compiled by an older compiler, that actually - include gstddef.h, such as collect2. */ - -/* Signed type of difference of two pointers. */ - -/* Define this type if we are doing the whole job, - or if we want this type in particular. */ -#if defined (_STDDEF_H) || defined (__need_ptrdiff_t) -#ifndef _PTRDIFF_T /* in case has defined it. */ -#ifndef _T_PTRDIFF_ -#ifndef _T_PTRDIFF -#ifndef __PTRDIFF_T -#ifndef _PTRDIFF_T_ -#ifndef _BSD_PTRDIFF_T_ -#ifndef ___int_ptrdiff_t_h -#ifndef _GCC_PTRDIFF_T -#define _PTRDIFF_T -#define _T_PTRDIFF_ -#define _T_PTRDIFF -#define __PTRDIFF_T -#define _PTRDIFF_T_ -#define _BSD_PTRDIFF_T_ -#define ___int_ptrdiff_t_h -#define _GCC_PTRDIFF_T -#ifndef __PTRDIFF_TYPE__ -#define __PTRDIFF_TYPE__ long int -#endif -typedef __PTRDIFF_TYPE__ ptrdiff_t; -#endif /* _GCC_PTRDIFF_T */ -#endif /* ___int_ptrdiff_t_h */ -#endif /* _BSD_PTRDIFF_T_ */ -#endif /* _PTRDIFF_T_ */ -#endif /* __PTRDIFF_T */ -#endif /* _T_PTRDIFF */ -#endif /* _T_PTRDIFF_ */ -#endif /* _PTRDIFF_T */ - -/* If this symbol has done its job, get rid of it. */ -#undef __need_ptrdiff_t - -#endif /* _STDDEF_H or __need_ptrdiff_t. */ - -/* Unsigned type of `sizeof' something. */ - -/* Define this type if we are doing the whole job, - or if we want this type in particular. */ -#if defined (_STDDEF_H) || defined (__need_size_t) -#ifndef __size_t__ /* BeOS */ -#ifndef _SIZE_T /* in case has defined it. */ -#ifndef _SYS_SIZE_T_H -#ifndef _T_SIZE_ -#ifndef _T_SIZE -#ifndef __SIZE_T -#ifndef _SIZE_T_ -#ifndef _BSD_SIZE_T_ -#ifndef _SIZE_T_DEFINED_ -#ifndef _SIZE_T_DEFINED -#ifndef ___int_size_t_h -#ifndef _GCC_SIZE_T -#ifndef _SIZET_ -#ifndef __size_t -#define __size_t__ /* BeOS */ -#define _SIZE_T -#define _SYS_SIZE_T_H -#define _T_SIZE_ -#define _T_SIZE -#define __SIZE_T -#define _SIZE_T_ -#define _BSD_SIZE_T_ -#define _SIZE_T_DEFINED_ -#define _SIZE_T_DEFINED -#define ___int_size_t_h -#define _GCC_SIZE_T -#define _SIZET_ -#define __size_t -#ifndef __SIZE_TYPE__ -#define __SIZE_TYPE__ long unsigned int -#endif -#if !(defined (__GNUG__) && defined (size_t)) -typedef __SIZE_TYPE__ size_t; -#ifdef __BEOS__ -typedef long ssize_t; -#endif /* __BEOS__ */ -#endif /* !(defined (__GNUG__) && defined (size_t)) */ -#endif /* __size_t */ -#endif /* _SIZET_ */ -#endif /* _GCC_SIZE_T */ -#endif /* ___int_size_t_h */ -#endif /* _SIZE_T_DEFINED */ -#endif /* _SIZE_T_DEFINED_ */ -#endif /* _BSD_SIZE_T_ */ -#endif /* _SIZE_T_ */ -#endif /* __SIZE_T */ -#endif /* _T_SIZE */ -#endif /* _T_SIZE_ */ -#endif /* _SYS_SIZE_T_H */ -#endif /* _SIZE_T */ -#endif /* __size_t__ */ -#undef __need_size_t -#endif /* _STDDEF_H or __need_size_t. */ - -/* Wide character type. - Locale-writers should change this as necessary to - be big enough to hold unique values not between 0 and 127, - and not (wchar_t) -1, for each defined multibyte character. */ - -/* Define this type if we are doing the whole job, - or if we want this type in particular. */ -#if defined (_STDDEF_H) || defined (__need_wchar_t) -#ifndef __wchar_t__ /* BeOS */ -#ifndef _WCHAR_T -#ifndef _T_WCHAR_ -#ifndef _T_WCHAR -#ifndef __WCHAR_T -#ifndef _WCHAR_T_ -#ifndef _BSD_WCHAR_T_ -#ifndef _WCHAR_T_DEFINED_ -#ifndef _WCHAR_T_DEFINED -#ifndef _WCHAR_T_H -#ifndef ___int_wchar_t_h -#ifndef __INT_WCHAR_T_H -#ifndef _GCC_WCHAR_T -#define __wchar_t__ /* BeOS */ -#define _WCHAR_T -#define _T_WCHAR_ -#define _T_WCHAR -#define __WCHAR_T -#define _WCHAR_T_ -#define _BSD_WCHAR_T_ -#define _WCHAR_T_DEFINED_ -#define _WCHAR_T_DEFINED -#define _WCHAR_T_H -#define ___int_wchar_t_h -#define __INT_WCHAR_T_H -#define _GCC_WCHAR_T - -/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_ - instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other - symbols in the _FOO_T_ family, stays defined even after its - corresponding type is defined). If we define wchar_t, then we - must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if - we undef _WCHAR_T_, then we must also define rune_t, since - headers like runetype.h assume that if machine/ansi.h is included, - and _BSD_WCHAR_T_ is not defined, then rune_t is available. - machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of - the same type." */ -#ifdef _BSD_WCHAR_T_ -#undef _BSD_WCHAR_T_ -#ifdef _BSD_RUNE_T_ -#if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE) -typedef _BSD_RUNE_T_ rune_t; -#endif -#endif -#endif - -#ifndef __WCHAR_TYPE__ -#ifdef __BEOS__ -#define __WCHAR_TYPE__ unsigned char -#else -#define __WCHAR_TYPE__ int -#endif -#endif -#ifndef __cplusplus -typedef __WCHAR_TYPE__ wchar_t; -#endif -#endif -#endif -#endif -#endif -#endif -#endif -#endif -#endif -#endif -#endif -#endif -#endif -#endif /* __wchar_t__ */ -#undef __need_wchar_t -#endif /* _STDDEF_H or __need_wchar_t. */ - -#if defined (_STDDEF_H) || defined (__need_wint_t) -#ifndef _WINT_T -#define _WINT_T - -#ifndef __WINT_TYPE__ -#define __WINT_TYPE__ unsigned int -#endif -typedef __WINT_TYPE__ wint_t; -#endif -#undef __need_wint_t -#endif - -/* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc. - are already defined. */ -/* BSD/OS 3.1 requires the MACHINE_ANSI_H check here. FreeBSD 2.x apparently - does not, even though there is a check for MACHINE_ANSI_H above. */ -#if defined(_ANSI_H_) || (defined(__bsdi__) && defined(_MACHINE_ANSI_H_)) -/* The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_ - are probably typos and should be removed before 2.8 is released. */ -#ifdef _GCC_PTRDIFF_T_ -#undef _PTRDIFF_T_ -#undef _BSD_PTRDIFF_T_ -#endif -#ifdef _GCC_SIZE_T_ -#undef _SIZE_T_ -#undef _BSD_SIZE_T_ -#endif -#ifdef _GCC_WCHAR_T_ -#undef _WCHAR_T_ -#undef _BSD_WCHAR_T_ -#endif -/* The following ones are the real ones. */ -#ifdef _GCC_PTRDIFF_T -#undef _PTRDIFF_T_ -#undef _BSD_PTRDIFF_T_ -#endif -#ifdef _GCC_SIZE_T -#undef _SIZE_T_ -#undef _BSD_SIZE_T_ -#endif -#ifdef _GCC_WCHAR_T -#undef _WCHAR_T_ -#undef _BSD_WCHAR_T_ +#include_next #endif -#endif /* _ANSI_H_ || ( __bsdi__ && _MACHINE_ANSI_H_ ) */ - -#endif /* __sys_stdtypes_h */ - -#endif /* RC_INVOKED */ - -/* A null pointer constant. */ - -#if defined (_STDDEF_H) || defined (__need_NULL) -#undef NULL /* in case has defined it. */ -#ifdef __GNUG__ -#define NULL __null -#else /* G++ */ -#define NULL ((void *)0) -#endif /* G++ */ -#endif /* NULL not defined and or need NULL. */ -#undef __need_NULL - -#ifdef _STDDEF_H - -/* Offset of member MEMBER in a struct of type TYPE. */ - -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) - -#endif /* _STDDEF_H was defined this time */ - -#endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__ - || __need_XXX was not defined before */ diff --git a/winsup/mingw/include/stdio.h b/winsup/mingw/include/stdio.h index 7a09250fb..88433d340 100644 --- a/winsup/mingw/include/stdio.h +++ b/winsup/mingw/include/stdio.h @@ -34,12 +34,14 @@ /* All the headers include this file. */ #include <_mingw.h> +#ifndef RC_INVOKED #define __need_size_t #define __need_NULL #define __need_wchar_t #define __need_wint_t -#ifndef RC_INVOKED #include +#define __need___va_list +#include #endif /* Not RC_INVOKED */ @@ -122,19 +124,12 @@ #ifndef RC_INVOKED -/* - * I used to include stdarg.h at this point, in order to allow for the - * functions later on in the file which use va_list. That conflicts with - * using stdio.h and varargs.h in the same file, so I do the typedef myself. - */ -#ifndef _VA_LIST -#define _VA_LIST -#if defined __GNUC__ && __GNUC__ >= 3 -typedef __builtin_va_list va_list; +#ifdef __GNUC__ +#define __VALIST __gnuc_va_list #else -typedef char* va_list; -#endif +#define __VALIST char* #endif + /* * The structure underlying the FILE type. * @@ -211,15 +206,15 @@ int fprintf (FILE*, const char*, ...); int printf (const char*, ...); int sprintf (char*, const char*, ...); int _snprintf (char*, size_t, const char*, ...); -int vfprintf (FILE*, const char*, va_list); -int vprintf (const char*, va_list); -int vsprintf (char*, const char*, va_list); -int _vsnprintf (char*, size_t, const char*, va_list); +int vfprintf (FILE*, const char*, __VALIST); +int vprintf (const char*, __VALIST); +int vsprintf (char*, const char*, __VALIST); +int _vsnprintf (char*, size_t, const char*, __VALIST); #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ int snprintf(char* s, size_t n, const char* format, ...); extern inline int vsnprintf (char* s, size_t n, const char* format, - va_list arg) + __VALIST arg) { return _vsnprintf ( s, n, format, arg); } #endif @@ -340,10 +335,10 @@ int fwprintf (FILE*, const wchar_t*, ...); int wprintf (const wchar_t*, ...); int swprintf (wchar_t*, const wchar_t*, ...); int _snwprintf (wchar_t*, size_t, const wchar_t*, ...); -int vfwprintf (FILE*, const wchar_t*, va_list); -int vwprintf (const wchar_t*, va_list); -int vswprintf (wchar_t*, const wchar_t*, va_list); -int _vsnwprintf (wchar_t*, size_t, const wchar_t*, va_list); +int vfwprintf (FILE*, const wchar_t*, __VALIST); +int vwprintf (const wchar_t*, __VALIST); +int vswprintf (wchar_t*, const wchar_t*, __VALIST); +int _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST); int fwscanf (FILE*, const wchar_t*, ...); int wscanf (const wchar_t*, ...); int swscanf (const wchar_t*, const wchar_t*, ...); @@ -372,9 +367,9 @@ FILE* _wpopen (const wchar_t*, const wchar_t*); #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ int snwprintf(wchar_t* s, size_t n, const wchar_t* format, ...); -extern inline int vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, - va_list arg) - { return _vsnwprintf ( s, n, format, arg); } +extern inline int +vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg) + { return _vsnwprintf ( s, n, format, arg);} #endif #define _WSTDIO_DEFINED diff --git a/winsup/mingw/include/varargs.h b/winsup/mingw/include/varargs.h index f81c864bc..c1197e97e 100644 --- a/winsup/mingw/include/varargs.h +++ b/winsup/mingw/include/varargs.h @@ -1,102 +1,7 @@ /* - * varargs.h - * - * Old, non-ANSI facilities for stepping through a list of function - * arguments of an unknown number and type. - * TODO: Has not been tested. Essentially it copies the GCC version. - * - * NOTE: I believe GCC supplies a version of this header as well (in - * addition to stdarg.h and others). The GCC version is more - * complex, to deal with many alternate systems, but it is - * probably more trustworthy overall. It would probably be - * better to use the GCC version. - * - * NOTE: These are incompatible with the versions in stdarg.h and should - * NOT be mixed! All new code should use the ANSI compatible versions. - * - * This file is part of the Mingw32 package. - * - * Contributors: - * Created by Colin Peters - * - * THIS SOFTWARE IS NOT COPYRIGHTED - * - * This source code is offered for use in the public domain. You may - * use, modify or distribute it freely. - * - * This code is distributed in the hope that it will be useful but - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAIMED. This includes but is not limited to warranties of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * $Revision$ - * $Author$ - * $Date$ - * + * This is just an RC_INVOKED guard for the real varargs.h + * fixincluded in gcc system dir. One day we will delete this file. */ - -#ifndef __STRICT_ANSI__ - -#ifndef _VARARGS_H_ -#define _VARARGS_H_ - -/* All the headers include this file. */ -#include <_mingw.h> - -/* - * I was told that Win NT likes this. - */ -#ifndef _VA_LIST_DEFINED -#define _VA_LIST_DEFINED -#endif - #ifndef RC_INVOKED - -#ifndef _VA_LIST -#define _VA_LIST -#if defined __GNUC__ && __GNUC__ >= 3 -typedef __builtin_va_list va_list; -#else -typedef char* va_list; -#endif +#include_next #endif - -/* - * Amount of space required in an argument list (ie. the stack) for an - * argument of type t. - */ -#define __va_argsiz(t) \ - (((sizeof(t) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) - -#define va_alist __builtin_va_alist - -/* - * Used in old style argument lists IIRC. The ellipsis forces the compiler - * to realize this is a vararg function. - */ -#define va_dcl int __builtin_va_alist; ... - -#define va_start(ap) \ - ((ap) = ((va_list) &__builtin_va_alist)) -#define va_end(ap) ((void)0) - - -/* - * Increment ap to the next argument in the list while returing a - * pointer to what ap pointed to first, which is of type t. - * - * We cast to void* and then to t* because this avoids a warning about - * increasing the alignment requirement. - */ - -#define va_arg(ap, t) \ - (((ap) = (ap) + __va_argsiz(t)), \ - *((t*) (void*) ((ap) - __va_argsiz(t)))) - - -#endif /* Not RC_INVOKED */ - -#endif /* Not _VARARGS_H_ */ - -#endif /* Not __STRICT_ANSI__ */ - diff --git a/winsup/mingw/mingwex/Makefile.in b/winsup/mingw/mingwex/Makefile.in index a358c06b7..ea79fbabc 100644 --- a/winsup/mingw/mingwex/Makefile.in +++ b/winsup/mingw/mingwex/Makefile.in @@ -98,7 +98,8 @@ MNO_CYGWIN = @MNO_CYGWIN@ INCLUDES = -I$(srcdir) -I$(srcdir)/../include \ -I$(srcdir)/../../w32api/include \ - -nostdinc -nostdinc++ + -nostdinc -nostdinc++ \ + -iwithprefixbefore include ALL_CFLAGS = $(CFLAGS) $(OPTFLAGS) $(INCLUDES) $(MNO_CYGWIN) ALL_CXXFLAGS = $(CXXFLAGS) $(OPTFLAGS) $(INCLUDES) $(MNO_CYGWIN) diff --git a/winsup/mingw/profile/Makefile.in b/winsup/mingw/profile/Makefile.in index eb89fe24d..c7f3a0c7f 100644 --- a/winsup/mingw/profile/Makefile.in +++ b/winsup/mingw/profile/Makefile.in @@ -49,7 +49,8 @@ THREAD_DLL_NAME = $(THREAD_DLL)$(THREAD_DLL_VERSION).dll INCLUDES = -I$(srcdir) -I$(srcdir)/../include \ -I$(srcdir)/../../w32api/include \ - -nostdinc -nostdinc++ + -nostdinc -nostdinc++ \ + -iwithprefixbefore include ALL_CFLAGS = $(CFLAGS) $(INCLUDES) $(MNO_CYGWIN) ALL_CXXFLAGS = $(CXXFLAGS) $(INCLUDES) $(MNO_CYGWIN) -- 2.43.5