[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / Posix / setvbuf.cpp
blobb7bcdf15499d2139b40e12756e8752513d984d06
1 // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
3 // UNSUPPORTED: target={{.*solaris.*}}
5 #include <stdio.h>
7 void print_something() {
8 for (size_t i = 0; i < 10 * BUFSIZ; i++)
9 printf("Hello world %zu\n", i);
12 void print_one_byte(char *buf) {
13 printf("First byte is %c\n", buf[0]);
16 void test_setbuf() {
17 char buf[BUFSIZ];
19 setbuf(stdout, NULL);
21 print_something();
23 setbuf(stdout, buf);
25 print_something();
27 print_one_byte(buf);
29 setbuf(stdout, NULL);
32 void test_setbuffer() {
33 char buf[BUFSIZ];
35 setbuffer(stdout, NULL, 0);
37 print_something();
39 // Ensure that interceptor reads correct size
40 // (not BUFSIZ as by default, hence BUFSIZ/2).
41 setbuffer(stdout, buf, BUFSIZ / 2);
43 print_something();
45 print_one_byte(buf);
47 setbuffer(stdout, NULL, 0);
50 void test_setlinebuf() {
51 setlinebuf(stdout);
53 print_something();
56 void test_setvbuf() {
57 char buf[BUFSIZ];
59 setvbuf(stdout, NULL, _IONBF, 0);
61 print_something();
63 setvbuf(stdout, buf, _IOLBF, BUFSIZ);
65 print_something();
67 print_one_byte(buf);
69 setvbuf(stdout, buf, _IOFBF, BUFSIZ);
71 print_something();
73 print_one_byte(buf);
75 setvbuf(stdout, NULL, _IONBF, 0);
78 int main(void) {
79 printf("setvbuf\n");
81 test_setbuf();
82 test_setbuffer();
83 test_setlinebuf();
84 test_setvbuf();
86 // CHECK: setvbuf
88 return 0;