From 38efa5f12862993a697398f41cfad4312f77e81f Mon Sep 17 00:00:00 2001 From: Danny Smith Date: Mon, 2 May 2005 08:03:34 +0000 Subject: [PATCH] * include/_mingw.h (__MINGW_ATTRIB_NONNULL): Don't define as variadic macro. * mingwex/mbrtowc.c (__mbrtowc_cp): Use __MINGW_ATTRIB_NONNULL. Remove unused MBTOWC_FLAGS define. --- winsup/mingw/ChangeLog | 9 ++++++++- winsup/mingw/include/_mingw.h | 8 +++++--- winsup/mingw/mingwex/mbrtowc.c | 12 +----------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 7a5565873..f9b7088fc 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,10 @@ +2005-05-02 Danny Smith + + * include/_mingw.h (__MINGW_ATTRIB_NONNULL): Don't define as + variadic macro. + * mingwex/mbrtowc.c (__mbrtowc_cp): Use __MINGW_ATTRIB_NONNULL. + Remove unused MBTOWC_FLAGS define. + 2005-04-23 Danny Smith * mingwex/mbrtowc.c: New file. @@ -11,7 +18,7 @@ funcions. Add __restrict__ to pointer params in prototypes. (wmemset. wmemchr, wmemcpy, wmemmove, wcstoll, wcstoull): Remove arg names from protototypes. - + 2005-04-23 Wu Yongwei * mingwex/dirent.c: Formatting changes. diff --git a/winsup/mingw/include/_mingw.h b/winsup/mingw/include/_mingw.h index c30b5eaed..32356f30b 100644 --- a/winsup/mingw/include/_mingw.h +++ b/winsup/mingw/include/_mingw.h @@ -136,11 +136,13 @@ #define __MINGW_ATTRIB_PURE #endif -/* Attribute `nonnull' was valid as of gcc 3.3. */ +/* Attribute `nonnull' was valid as of gcc 3.3. We don't use GCC's + variadiac macro facility, because variadic macros causes syntax + errors with --traditional-cpp. */ #if (__GNUC__ > 3 ||( __GNUC__ == 3 && __GNUC_MINOR >= 3)) -#define __MINGW_ATTRIB_NONNULL(args...) __attribute__ ((__nonnull__ (args))) +#define __MINGW_ATTRIB_NONNULL(arg) __attribute__ ((__nonnull__ (arg))) #else -#define __MINGW_ATTRIB_NONNULL(args...) +#define __MINGW_ATTRIB_NONNULL(arg) #endif /* GNUC >= 3.3 */ #ifndef __MSVCRT_VERSION__ diff --git a/winsup/mingw/mingwex/mbrtowc.c b/winsup/mingw/mingwex/mbrtowc.c index e337417c4..adf3c7633 100755 --- a/winsup/mingw/mingwex/mbrtowc.c +++ b/winsup/mingw/mingwex/mbrtowc.c @@ -5,17 +5,7 @@ #define WIN32_LEAN_AND_MEAN #include -#define MBTOWC_FLAGS (MB_PRECOMPOSED | MB_ERR_INVALID_CHARS) -/* Attribute `nonnull' was valid as of gcc 3.3. */ -#ifndef ATTRIBUTE_NONNULL -# if (__GNUC__ > 3 ||( __GNUC__ == 3 && __GNUC_MINOR__ >= 3)) -# define ATTRIBUTE_NONNULL(m...) __attribute__ ((__nonnull__ (m))) -# else -# define ATTRIBUTE_NONNULL(m...) -# endif /* GNUC >= 3.3 */ -#endif /* ATTRIBUTE_NONNULL */ - -static int ATTRIBUTE_NONNULL(1, 4) +static int __MINGW_ATTRIB_NONNULL(1) __MINGW_ATTRIB_NONNULL(4) __mbrtowc_cp (wchar_t * __restrict__ pwc, const char * __restrict__ s, size_t n, mbstate_t* __restrict__ ps, const unsigned int cp, const unsigned int mb_max)