================
@@ -51,6 +51,17 @@ void check_freopen(void) {
if (errno) {} // expected-warning{{An undefined value may be read from
'errno'}}
}
+void check_popen(void) {
+ FILE *F = popen("xxx", "r");
+ if (!F) {
+ clang_analyzer_eval(errno != 0); // expected-warning{{TRUE}}
+ if (errno) {} // no-warning
+ } else {
+ if (errno) {} // expected-warning{{An undefined value may be read from
'errno' [unix.Errno]}}
+ pclose(F);
+ }
+}
+
----------------
benshi001 wrote:
I have put these tests to `errno-stdlibraryfunctions.c`, which seems better,
since tests in `std-c-library-functions-POSIX.c` do not involve `errno`.
https://github.com/llvm/llvm-project/pull/78895
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits