]>
Commit | Line | Data |
---|---|---|
f01e4069 UD |
1 | #include <wchar.h> |
2 | ||
c1760eaf MS |
3 | extern int fclose (FILE*); |
4 | ||
5 | #if defined __GNUC__ && __GNUC__ >= 11 | |
6 | /* Verify that calling fclose on the result of open_wmemstream doesn't | |
7 | trigger GCC -Wmismatched-dealloc with fclose forward-declared and | |
8 | without <stdio.h> included first (it is included later, in. | |
9 | "tst-memstream1.c"). */ | |
10 | #pragma GCC diagnostic push | |
11 | #pragma GCC diagnostic error "-Wmismatched-dealloc" | |
12 | #endif | |
13 | ||
14 | int test_open_wmemstream_no_stdio (void) | |
15 | { | |
16 | { | |
17 | wchar_t *buf; | |
18 | size_t size; | |
19 | FILE *f = open_wmemstream (&buf, &size); | |
20 | fclose (f); | |
21 | } | |
22 | ||
23 | { | |
24 | FILE* (*pf)(wchar_t**, size_t*) = open_wmemstream; | |
25 | wchar_t *buf; | |
26 | size_t size; | |
27 | FILE *f = pf (&buf, &size); | |
28 | fclose (f); | |
29 | } | |
30 | return 0; | |
31 | } | |
32 | ||
33 | #if defined __GNUC__ && __GNUC__ >= 11 | |
34 | /* Restore -Wmismatched-dealloc setting. */ | |
35 | # pragma GCC diagnostic pop | |
36 | #endif | |
37 | ||
bb10459f UD |
38 | #define CHAR_T wchar_t |
39 | #define W(o) L##o | |
40 | #define OPEN_MEMSTREAM open_wmemstream | |
41 | ||
42 | #include "tst-memstream1.c" |