From patchwork Thu Oct 24 16:01:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 1183208 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-511690-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Qrc0SZaO"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="B0y6aowU"; 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 46zX7C1m5dz9sQm for ; Fri, 25 Oct 2019 03:01:56 +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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=ZgS5AMKyINvSuuScuzIGfCGnNJD6M+HZVKcn5RTGLIY7IOeNlW /YQZdRfTmFswuJiFyE2hv5vBiZ0sVB67nn3D8ncXli9FOeMsyIKRncP2KIxk1U3n 85+8zh7hukXuA+EoMCcPStV72ZGyw+u3n1+vRU5IMpGWOgyR+yIYL7R0g= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=Kzua5flV/7z3qNeuNtCgC0VMdjg=; b=Qrc0SZaOrh84Diz9UNAc KZI34Vep9y5CUhoHn5Ls2iIpyBwE6cnhXn7l/80cOd3HqRDW432g18VPi6a4EH4m jVa5ij4GZgVk8zkQ75xJW4dhYUCTAHSJb/Ze4z39T1uw2L6ZDbTWcJ6YWZ1GkQh/ oTL0cS7swBM/RBCazrDIyxo= Received: (qmail 119813 invoked by alias); 24 Oct 2019 16:01:49 -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 119804 invoked by uid 89); 24 Oct 2019 16:01:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-HELO:sk:mail-pg X-HELO: mail-pg1-f179.google.com Received: from mail-pg1-f179.google.com (HELO mail-pg1-f179.google.com) (209.85.215.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 24 Oct 2019 16:01:47 +0000 Received: by mail-pg1-f179.google.com with SMTP id e10so14495793pgd.11 for ; Thu, 24 Oct 2019 09:01:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=QSvNFyfPpEulzxAdKb9eI8yHvnpqbxQrRS+fEjF1kcE=; b=B0y6aowUWBymvoKyFq1b7SD0RKGRCHUFHRQrLtPhJwiPDARjgHtgNXYNwUlDg2IFLS lUpeHMg/JhLkc2EGxLNQ/9xuDcRFJg5kekiJyJRCGqXwdq4WJyXjDyecqfmdrP6A3a0J d+iGQOb9EK6GYZt87pnyR2zXfc4eLDgfTnbVFdvSFQ41ABjX9CM6opHogPWNZ+4vSAoc Yiw9Vm5BvaPG0q2E4V41GSdQwWkSiO0FdUPObFAXfK8UM80Tt4qJBAG4VNngTNArR0pu paRpylXwwop+t0U5G0o4nqf9JObsRoEgdLfQ5FL73s5Mnd1s2km3Wh6XPFkplP8RI4SR h1xA== Received: from ?IPv6:2620:10d:c082:1055:35ad:ea4a:705a:2c00? ([2620:10d:c090:200::2:6235]) by smtp.googlemail.com with ESMTPSA id c8sm29352071pfi.117.2019.10.24.09.01.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Oct 2019 09:01:44 -0700 (PDT) To: GCC Patches From: Nathan Sidwell Subject: [dump] small source cleanup Message-ID: <168d1fe1-57f1-6de2-d2e2-b93e93a68619@acm.org> Date: Thu, 24 Oct 2019 09:01:43 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 due to my own stupidity I found myself wandering into dump_begin, but then got confused due to an uninitialized pointer not pointing to somewhere totally insane. Applying this cleanup patch to initialize the decls at creation time. nathan 2019-10-24 Nathan Sidwell * dumpfile.c (dump_begin): Reorder decls to use RAII. Index: gcc/dumpfile.c =================================================================== --- gcc/dumpfile.c (revision 277405) +++ gcc/dumpfile.c (working copy) @@ -1533,19 +1533,15 @@ gcc::dump_manager:: dump_begin (int phase, dump_flags_t *flag_ptr, int part) { - char *name; - struct dump_file_info *dfi; - FILE *stream; - if (phase == TDI_none || !dump_phase_enabled_p (phase)) return NULL; - name = get_dump_file_name (phase, part); + char *name = get_dump_file_name (phase, part); if (!name) return NULL; - dfi = get_dump_file_info (phase); + struct dump_file_info *dfi = get_dump_file_info (phase); /* We do not support re-opening of dump files with parts. This would require tracking pstate per part of the dump file. */ - stream = dump_open (name, part != -1 || dfi->pstate < 0); + FILE *stream = dump_open (name, part != -1 || dfi->pstate < 0); if (stream) dfi->pstate = 1;