Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / Posix / devname_r.cpp
blob5f0968e2be55ba839a4c25ddeeb8dab86d0ab325
1 // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
2 // UNSUPPORTED: target={{.*(linux|solaris).*}}
4 #include <sys/cdefs.h>
5 #include <sys/stat.h>
7 #include <assert.h>
8 #include <stdio.h>
9 #include <stdlib.h>
11 int main(void) {
12 struct stat st;
13 char name[100];
14 mode_t type;
16 assert(!stat("/dev/null", &st));
18 type = S_ISCHR(st.st_mode) ? S_IFCHR : S_IFBLK;
20 #if defined(__NetBSD__)
21 assert(!devname_r(st.st_rdev, type, name, sizeof(name)));
22 #else
23 assert(devname_r(st.st_rdev, type, name, sizeof(name)));
24 #endif
26 printf("%s\n", name);
28 // CHECK: null
30 return 0;