OSDN Git Service

2011-10-19 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / torture / pr50723.c
1 /* { dg-do compile } */
2
3 typedef short unsigned int wchar_t;
4 typedef unsigned int size_t;
5 int* _errno(void);
6 int WideCharToMultiByte (wchar_t *);
7 int __attribute__ ((__nonnull__ (1)))
8 __wcrtomb_cp (char *dst, wchar_t wc, const unsigned int cp,
9               const unsigned int mb_max)
10 {
11   if (cp == 0)     {
12       if (wc > 255) 
13         (*_errno()) = 42;
14       return 1;
15   }
16   else 
17     return WideCharToMultiByte (&wc);
18 }
19 void wcsrtombs (char *dst, const wchar_t *pwc, unsigned int cp,
20                 unsigned int mb_max)
21 {
22   if ((__wcrtomb_cp (dst, *pwc, cp, mb_max)) <= 0)
23     return;
24   if ((__wcrtomb_cp (dst, *pwc, cp, mb_max)) <= 0)
25     return;
26 }