From patchwork Sat Nov 16 01:23:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 1196014 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-513738-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="EBtTiQUr"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="emCOLoJR"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47FHWq0DBwz9sPV for ; Sat, 16 Nov 2019 12:22:28 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :content-type:content-transfer-encoding; q=dns; s=default; b=Izf O6abfpaUlODvd0SAN4fWA2iOeJpQglUUkKuGi6YvgQkBKwh48eBd1Lxva5iJTN7T WghtgsIJRrODVNEdum5HhgeoccQ/XnyJccph6PBA1stvfvrnHLOHlTp8qtzozeW6 HkKSDTYO8cmmll01SiIcey1pGpBuB3LDK8EzvaTE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :content-type:content-transfer-encoding; s=default; bh=tLxj9Ip7N fnzK0Us6BbRpugIQsc=; b=EBtTiQUrs/aQYHdQSQD1m0HRH89rggmJkJANU86Qf QVxJ5LeRY3IcDBNZW+JCyoLILkzzQ4QzLW7tnp0S8pVUOIXNrumjL+x92wUnaqYj nIw4Kzb02Y5aFnNTxSf8hMwFLz38EzyxZ0vYRy6oEzhGcHg7ZMkMurXCaaMS9FGH LA= Received: (qmail 60893 invoked by alias); 16 Nov 2019 01:18:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 58213 invoked by uid 89); 16 Nov 2019 01:17:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_PASS autolearn=ham version=3.3.1 spammy=Purge, 2696 X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-1.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (205.139.110.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 16 Nov 2019 01:17:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573867052; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=49gJXKaIoRWNiwf2Szmxx/iWCxMQhCFFEK4nqptyCsc=; b=emCOLoJR1LhZHbyKWmarQ7r6PJkejrh80nWrH2fdnItzzdidJKH4TqDFu/gSn1gzMR74IN MsBY3GVJ8nmJ3KPAmjldCMtw0NA5dyJZFIMYOEmGuE6UWYe8zgnygKmp88jRbrlBSu6smm XsnjHiFlomfmG31mISuWNg6Hwb+tYOc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-116-uSWzeJYpOg21KpFjuBoCIQ-1; Fri, 15 Nov 2019 20:17:28 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C45C7800686 for ; Sat, 16 Nov 2019 01:17:27 +0000 (UTC) Received: from c64.redhat.com (ovpn-112-32.phx2.redhat.com [10.3.112.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id D91E310246FB; Sat, 16 Nov 2019 01:17:26 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH 21/49] analyzer: command-line options Date: Fri, 15 Nov 2019 20:23:08 -0500 Message-Id: <1573867416-55618-22-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1573867416-55618-1-git-send-email-dmalcolm@redhat.com> References: <1573867416-55618-1-git-send-email-dmalcolm@redhat.com> X-Mimecast-Spam-Score: 0 X-IsSubscribed: yes This patch contains the command-line options for the analyzer. gcc/ChangeLog: * analyzer/plugin.opt: New file. * common.opt (--analyzer): New driver option. --- gcc/analyzer/plugin.opt | 161 ++++++++++++++++++++++++++++++++++++++++++++++++ gcc/common.opt | 3 + 2 files changed, 164 insertions(+) create mode 100644 gcc/analyzer/plugin.opt diff --git a/gcc/analyzer/plugin.opt b/gcc/analyzer/plugin.opt new file mode 100644 index 0000000..55f54bb --- /dev/null +++ b/gcc/analyzer/plugin.opt @@ -0,0 +1,161 @@ +; plugin.opt -- Options for the analyzer. + +; Copyright (C) 2019 Free Software Foundation, Inc. +; +; This file is part of GCC. +; +; GCC is free software; you can redistribute it and/or modify it under +; the terms of the GNU General Public License as published by the Free +; Software Foundation; either version 3, or (at your option) any later +; version. +; +; GCC is distributed in the hope that it will be useful, but WITHOUT ANY +; WARRANTY; without even the implied warranty of MERCHANTABILITY or +; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +; for more details. +; +; You should have received a copy of the GNU General Public License +; along with GCC; see the file COPYING3. If not see +; . + +; See the GCC internals manual for a description of this file's format. + +; Please try to keep this file in ASCII collating order. + +Wanalyzer-double-fclose +Common Var(warn_analyzer_double_fclose) Init(1) Warning +Warn about code paths in which a stdio FILE can be closed more than once. + +Wanalyzer-double-free +Common Var(warn_analyzer_double_free) Init(1) Warning +Warn about code paths in which a pointer can be freed more than once. + +Wanalyzer-exposure-through-output-file +Common Var(warn_analyzer_exposure_through_output_file) Init(1) Warning +Warn about code paths in which sensitive data is written to a file. + +Wanalyzer-file-leak +Common Var(warn_analyzer_file_leak) Init(1) Warning +Warn about code paths in which a stdio FILE is not closed. + +Wanalyzer-free-of-non-heap +Common Var(warn_analyzer_free_of_non_heap) Init(1) Warning +Warn about code paths in which a non-heap pointer is freed. + +Wanalyzer-malloc-leak +Common Var(warn_analyzer_malloc_leak) Init(1) Warning +Warn about code paths in which a heap-allocated pointer leaks. + +Wanalyzer-possible-null-argument +Common Var(warn_analyzer_possible_null_argument) Init(1) Warning +Warn about code paths in which a possibly-NULL value is passed to a must-not-be-NULL function argument. + +Wanalyzer-possible-null-dereference +Common Var(warn_analyzer_possible_null_dereference) Init(1) Warning +Warn about code paths in which a possibly-NULL pointer is dereferenced. + +Wanalyzer-null-argument +Common Var(warn_analyzer_null_argument) Init(1) Warning +Warn about code paths in which NULL is passed to a must-not-be-NULL function argument. + +Wanalyzer-null-dereference +Common Var(warn_analyzer_null_dereference) Init(1) Warning +Warn about code paths in which a NULL pointer is dereferenced. + +Wanalyzer-stale-setjmp-buffer +Common Var(warn_analyzer_stale_setjmp_buffer) Init(1) Warning +Warn about code paths in which a longjmp rewinds to a jmp_buf saved in a stack frame that has returned. + +Wanalyzer-tainted-array-index +Common Var(warn_analyzer_tainted_array_index) Init(1) Warning +Warn about code paths in which an unsanitized value is used as an array index. + +Wanalyzer-use-after-free +Common Var(warn_analyzer_use_after_free) Init(1) Warning +Warn about code paths in which a freed value is used. + +Wanalyzer-use-of-pointer-in-stale-stack-frame +Common Var(warn_analyzer_use_of_pointer_in_stale_stack_frame) Init(1) Warning +Warn about code paths in which a pointer to a stale stack frame is used. + +Wanalyzer-use-of-uninitialized-value +Common Var(warn_analyzer_use_of_uninitialized_value) Init(1) Warning +Warn about code paths in which an initialized value is used. + +Wanalyzer-too-complex +Common Var(warn_analyzer_too_complex) Init(0) Warning +Warn if the code is too complicated for the analyzer to fully explore. + +fanalyzer-checker= +Common Joined RejectNegative Var(flag_analyzer_checker) +Restrict the analyzer to run just the named checker. + +fanalyzer-fine-grained +Common Var(flag_analyzer_fine_grained) Init(0) +Avoid combining multiple statements into one exploded edge. + +fanalyzer-state-purge +Common Var(flag_analyzer_state_purge) Init(1) +Purge unneeded state during analysis. + +fanalyzer-state-merge +Common Var(flag_analyzer_state_merge) Init(1) +Merge similar-enough states during analysis. + +fanalyzer-transitivity +Common Var(flag_analyzer_transitivity) Init(0) +Enable transitivity of constraints during analysis. + +fanalyzer-call-summaries +Common Var(flag_analyzer_call_summaries) Init(0) +Approximate the effect of function calls to simplify analysis. + +fanalyzer-verbose-edges +Common Var(flag_analyzer_verbose_edges) Init(0) +Emit more verbose descriptions of control flow in diagnostics. + +fanalyzer-verbose-state-changes +Common Var(flag_analyzer_verbose_state_changes) Init(0) +Emit more verbose descriptions of state changes in diagnostics. + +fanalyzer-verbosity= +Common Joined UInteger Var(analyzer_verbosity) Init(2) +Control which events are displayed in diagnostic paths. + +fdump-analyzer +Common RejectNegative Var(flag_dump_analyzer) +Dump internal details about what the analyzer is doing to SRCFILE.analyzer.txt. + +fdump-analyzer-stderr +Common RejectNegative Var(flag_dump_analyzer_stderr) +Dump internal details about what the analyzer is doing to stderr. + +fdump-analyzer-callgraph +Common RejectNegative Var(flag_dump_analyzer_callgraph) +Dump the analyzer supergraph to a SRCFILE.callgraph.dot file. + +fdump-analyzer-exploded-graph +Common RejectNegative Var(flag_dump_analyzer_exploded_graph) +Dump the analyzer exploded graph to a SRCFILE.eg.dot file. + +fdump-analyzer-exploded-nodes +Common RejectNegative Var(flag_dump_analyzer_exploded_nodes) +Emit diagnostics showing the location of nodes in the exploded graph. + +fdump-analyzer-exploded-nodes-2 +Common RejectNegative Var(flag_dump_analyzer_exploded_nodes_2) +Dump a textual representation of the exploded graph to SRCFILE.eg.txt. + +fdump-analyzer-exploded-nodes-3 +Common RejectNegative Var(flag_dump_analyzer_exploded_nodes_3) +Dump a textual representation of the exploded graph to SRCFILE.eg-ID.txt. + +fdump-analyzer-state-purge +Common RejectNegative Var(flag_dump_analyzer_state_purge) +Dump state-purging information to a SRCFILE.state-purge.dot file. + +fdump-analyzer-supergraph +Common RejectNegative Var(flag_dump_analyzer_supergraph) +Dump the analyzer supergraph to a SRCFILE.supergraph.dot file. + +; This comment is to ensure we retain the blank line above. diff --git a/gcc/common.opt b/gcc/common.opt index adc9931..0c352a3 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -269,6 +269,9 @@ Driver Joined Alias(e) -extra-warnings Common Warning Alias(Wextra) +-analyzer +Driver Var(analyzer_flag) + -for-assembler Driver Separate Alias(Xassembler)