From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id D86D03836C5B for ; Mon, 1 Feb 2021 11:44:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D86D03836C5B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wm1-x336.google.com with SMTP id i9so12912583wmq.1 for ; Mon, 01 Feb 2021 03:44:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0ak4S4O6t/AACzoKhAnqxtF6GHE0fy1Szhr0fcUYp5U=; b=c6Dmtr2aBXgacCCwlPEb6K5uzyyIcrJXKhLP+Yiw8cVTG0V+wnxJpx+mitaAnyr97F ad1rlmylkM/z0kvTIEFT7Re6bEA4y8eFNieWFHhohM6L7Kmo0ExkOpl/fVK5jSbqDQ1A eXsXm018GN50qO+Np/h+3Y6kS6W70N/bQ5W/M+gCQrm3c/npuEPQAcuG7V/WSCW8hjU/ RKgJ5NvqvSmaxUcCWdwnmEgKnum6p96oZPuW9cI1Uz+1X4R3Ts/L2z1zEAg+/LbdiA+D xqihtpjb8DsLkb5gX9cC5KlnD0UqUXGOVlTcLiDLOZxtKIg1+0ICuskl3po37lLJ8Lzi 4UBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0ak4S4O6t/AACzoKhAnqxtF6GHE0fy1Szhr0fcUYp5U=; b=VLz8qtgpB/8/hYyOcoAg8/Xn2uMWbCiRYjFZ+RRbOCSZ8no7C0naUTyOGKkr+FAWEy UbiuuISfBOXMZ7xzN7IQet85blWcM6cloVAuvMVcN5YtA53CbxTf25kMS+28Sd9QwScy nOvfonT/JkVPAjXJOQSbp1iGFyKvLYl9hxDe9bZLAm+zjS+9MFTwdzWPSX6I0pU5si/8 ROSKmpsLDoruvBWDn5cWUaFd1LTZ/zwgLPo4uDjQzKIe0Nebu5JqtzPfZJS08WqHxtt5 gsGxRBw+d+maYLFXDn7YJs+6oyPKA1nSsUnOm+H911ITWXT3AF+n6ubMRbbuV877UI6D Blwg== X-Gm-Message-State: AOAM530joxYr0/Q9Zofpvvn3e/3mmkURIwo4tAOpoMav9OQDwLZpEIWf Jg2Ha1kL+Bz0DjGx+CR6w4A4REbOZ58PPg== X-Google-Smtp-Source: ABdhPJzjv4jx61nObkScDUPrnWKgK5emMSB7c9bjOBjvBHcHGRmGfxhn0Bp7fyr0Hg4eHtby5yRymw== X-Received: by 2002:a1c:7e4e:: with SMTP id z75mr14909579wmc.168.1612179869786; Mon, 01 Feb 2021 03:44:29 -0800 (PST) Received: from localhost (host86-191-239-31.range86-191.btcentralplus.com. [86.191.239.31]) by smtp.gmail.com with ESMTPSA id a6sm20297741wmj.27.2021.02.01.03.44.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 03:44:29 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: [PATCH 07/11] sim/rx: move some variable declarations to the start of the block Date: Mon, 1 Feb 2021 11:44:10 +0000 Message-Id: <1b842eda3cbf2f16d414c6bca3f250bb8a1e11ac.1612179773.git.andrew.burgess@embecosm.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 11:44:32 -0000 For sim code variables still need to be declared at the start of the enclosing block. This silences a few GCC warnings. sim/rx/ChangeLog: * syscalls.c (rx_syscall): Move declaration of some variables to the start of the enclosing block. * trace.c (load_file_and_line): Likewise. --- sim/rx/ChangeLog | 6 ++++++ sim/rx/syscalls.c | 5 +++-- sim/rx/trace.c | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sim/rx/syscalls.c b/sim/rx/syscalls.c index 2f89da17330..22778b3df49 100644 --- a/sim/rx/syscalls.c +++ b/sim/rx/syscalls.c @@ -160,6 +160,7 @@ rx_syscall (int id) case SYS_open: { + int oflags, cflags; int path = arg (); /* The open function is defined as taking a variable number of arguments because the third parameter to it is optional: @@ -167,8 +168,8 @@ rx_syscall (int id) Hence the oflags and cflags arguments will be on the stack and we need to skip the (empty) argument registers r3 and r4. */ argp = 4; - int oflags = arg (); - int cflags = arg (); + oflags = arg (); + cflags = arg (); read_target (buf, path, 256, 1); if (trace) diff --git a/sim/rx/trace.c b/sim/rx/trace.c index 6f9294ad75a..9d9f2dfd98d 100644 --- a/sim/rx/trace.c +++ b/sim/rx/trace.c @@ -139,6 +139,7 @@ load_file_and_line (const char *filename, int lineno) break; if (!f) { + FILE *file; int i; struct stat s; const char *found_filename, *slash; @@ -159,7 +160,7 @@ load_file_and_line (const char *filename, int lineno) files = f; f->filename = strdup (filename); f->data = (char *) malloc (s.st_size + 2); - FILE *file = fopen (found_filename, "rb"); + file = fopen (found_filename, "rb"); fread (f->data, 1, s.st_size, file); f->data[s.st_size] = 0; fclose (file); -- 2.25.4