[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


================
@@ -259,14 +283,33 @@ void error_indeterminate_clearerr(void) {
   fclose(F);
 }
 
+void error_indeterminate_fgetc(void) {
+  FILE *F = fopen("file", "r+");
+  if (!F)
+    return;
+  int rc = fseek(F, 0, SEEK_SET);
+  if (rc) {
+    if (feof(F)) {
----------------
balazske wrote:

First branch of `if` is not needed. But I still think that these tests (with `fgetc` and `fputc`) are not testing different conditions than the other test (the condition that we have a warning for _might be 'indeterminate'_), therefore can be removed.

https://github.com/llvm/llvm-project/pull/72627


More information about the cfe-commits mailing list