Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Misc / dev-fd-fs.c
blobea94d950b0716df410eeefc85fe58e7f7723f9e0
1 // Check that we can operate on files from /dev/fd.
2 // REQUIRES: dev-fd-fs
3 // REQUIRES: shell
5 // Check reading from named pipes. We cat the input here instead of redirecting
6 // it to ensure that /dev/fd/0 is a named pipe, not just a redirected file.
7 //
8 // RUN: cat %s | %clang -x c /dev/fd/0 -E > %t
9 // RUN: FileCheck --check-prefix DEV-FD-INPUT < %t %s
11 // RUN: cat %s | %clang -x c %s -E -DINCLUDE_FROM_STDIN > %t
12 // RUN: FileCheck --check-prefix DEV-FD-INPUT \
13 // RUN: --check-prefix DEV-FD-INPUT-INCLUDE < %t %s
15 // DEV-FD-INPUT-INCLUDE: int w;
16 // DEV-FD-INPUT: int x;
17 // DEV-FD-INPUT-INCLUDE: int y;
20 // Check writing to /dev/fd named pipes. We use cat here as before to ensure we
21 // get a named pipe.
23 // RUN: %clang -x c %s -E -o /dev/fd/1 | cat > %t
24 // RUN: FileCheck --check-prefix DEV-FD-FIFO-OUTPUT < %t %s
26 // DEV-FD-FIFO-OUTPUT: int x;
29 // Check writing to /dev/fd regular files.
31 // RUN: %clang -x c %s -E -o /dev/fd/1 > %t
32 // RUN: FileCheck --check-prefix DEV-FD-REG-OUTPUT < %t %s
34 // DEV-FD-REG-OUTPUT: int x;
36 #ifdef INCLUDE_FROM_STDIN
37 #undef INCLUDE_FROM_STDIN
38 int w;
39 #include "/dev/fd/0"
40 int y;
41 #else
42 int x;
43 #endif