[clang] [clang][analyzer] Support `fgetc` in StreamChecker (PR #72627)
Balázs Kéri via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 23 01:46:18 PST 2023
================
@@ -303,3 +346,29 @@ void error_indeterminate_feof2(void) {
}
fclose(F);
}
+
+void error_indeterminate_feof3(void) {
+ FILE *F = fopen("file", "r+");
+ if (!F)
+ return;
+ if (fgetc(F) == EOF) {
+ if (feof(F)) {
+ // error is feof, should be non-indeterminate
+ fputc('A', F); // no warning
+ }
+ }
+ fclose(F);
+}
+
+void error_indeterminate_feof4(void) {
----------------
balazske wrote:
This test seems to be not necessary (previous tests cover these conditions), otherwise a more meaningful name should be chosen for it.
https://github.com/llvm/llvm-project/pull/72627
More information about the cfe-commits
mailing list