diff options
author | David Malcolm <dmalcolm@redhat.com> | 2019-12-19 16:10:41 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2020-01-14 21:10:45 -0500 |
commit | 24918a9b20c771984f41f90c3352c3ebee8b5e6f (patch) | |
tree | c43e7b6c06c3183bee103da0ff484e6846c7454c /gcc/doc/invoke.texi | |
parent | d666ae9862a06cab12108607c516a8475b4fb766 (diff) | |
download | gcc-devel/analyzer.tar.gz |
analyzer: add -Wanalyzer-use-of-closed-filedevel/analyzer
gcc/analyzer/ChangeLog:
* analyzer.opt (Wanalyzer-use-of-closed-file): New option.
* sm-file.cc (class use_of_closed_file): New file_diagnostic subclass.
(find_file_param): New function.
(fileptr_state_machine::on_stmt): Complain about operations on
closed files.
gcc/ChangeLog:
* doc/invoke.texi (-Wanalyzer-use-of-closed-file): Document new
option.
gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/file-1.c (test_5): New test.
Diffstat (limited to 'gcc/doc/invoke.texi')
-rw-r--r-- | gcc/doc/invoke.texi | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 13742042de2..543874825f2 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -309,6 +309,7 @@ Objective-C and Objective-C++ Dialects}. -Wno-analyzer-tainted-array-index @gol -Wno-analyzer-unsafe-call-within-signal-handler @gol -Wno-analyzer-use-after-free @gol +-Wno-analyzer-use-of-closed-file @gol -Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol -Wno-analyzer-use-of-uninitialized-value @gol -Wanalyzer-too-complex @gol @@ -409,6 +410,7 @@ Objective-C and Objective-C++ Dialects}. -Wanalyzer-tainted-array-index @gol -Wanalyzer-unsafe-call-within-signal-handler @gol -Wanalyzer-use-after-free @gol +-Wanalyzer-use-of-closed-file @gol -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol -Wanalyzer-use-of-uninitialized-value @gol -Wanalyzer-too-complex @gol @@ -6615,6 +6617,16 @@ This warning requires @option{-fanalyzer}, which enables it; use This diagnostic warns for paths through the code in which a pointer is used after @code{free} is called on it. +@item -Wno-analyzer-use-of-closed-file +@opindex Wanalyzer-use-of-closed-file +@opindex Wno-analyzer-use-of-closed-file +This warning requires @option{-fanalyzer}, which enables it; use +@option{-Wno-analyzer-use-of-closed-file} to disable it. + +This diagnostic warns for paths through the code in which a +@code{<stdio.h>} @code{FILE *} stream object is used after +@code{fclose} is called on it. + @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame @@ -8330,6 +8342,7 @@ Enabling this option effectively enables the following warnings: -Wanalyzer-tainted-array-index @gol -Wanalyzer-unsafe-call-within-signal-handler @gol -Wanalyzer-use-after-free @gol +-Wanalyzer-use-of-closed-file @gol -Wanalyzer-use-of-uninitialized-value @gol -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol } |