From patchwork Tue Mar 5 05:48:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 159630 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp4590596jad; Mon, 4 Mar 2019 21:51:15 -0800 (PST) X-Google-Smtp-Source: APXvYqwBxRwuQqD1XcYspsQL9ElvFHbyg79PXyCXJdckLhlNtXBfBcbw1ZE8E88+knaBWw3f/kQF X-Received: by 2002:aa7:9255:: with SMTP id 21mr204604pfp.8.1551765075657; Mon, 04 Mar 2019 21:51:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551765075; cv=none; d=google.com; s=arc-20160816; b=icPf119lc+HjC/CdqrSLpaaTdumeXoicRYYLyNstZxPWrQnU3PECN0vGTaNXQwxF9k ttPB25H1BgFtD1p8ycUe3EpLf6RSnI/IhTrrYXI60T+vUskKo38sL7REgr4RSSlCUfYd J8N6v5hWA2fo5mIs8YDuxd2UihgAzWegkbzIoU07cqDaoiYvXA/+GoSpc4i4K7bLKuqe cRep0SiMyKH39+0bKEo1lnVbxV3IXu0k7LJqXa6aeSZdx/hygzO5CCfEVYnuxUszH3El SR4L444fDX0YsbwhM0JNa5qG+SnE2wELe1ApWYoYNQhAgK1yUBYD8HvMWNMQr8gMBBlr Zt2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=upricv6fVewsTKjghecoorebp9rRB3J2zizg4F0dOiY=; b=ho1YKZ4miLA7Ct8YrMB4QEHtZCxjkmx8PEvsFwPNXOjm1RFSlicIPhbqdJErdk6H5s Ib2FaSAkNtVJwl57sTq07DkDoa3so6CGc1gn9aP5RJD5BdLwIffzI0wUb3deaVwKOZGa DOTpMjkjRrnUD4kC6zfU6vWzbbyZ1k+w+NyldnIvy0yesivmeoTgdVmwoevhjLCdSenq 0FxLEDJ8IpOS5tyHInIQn5g4VAQu22zli4XPytxWNejsSft+i/Fha9VCb04qmt8/lgUX KhFX0qCUXthyh7yT+rJsDUkEdV+/2UFp9+V/uWrnT3DldoFQMLAToR98S5YgUDzE/aaP N0BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=psm7CSLg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si7330699pgo.461.2019.03.04.21.51.15; Mon, 04 Mar 2019 21:51:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=psm7CSLg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727081AbfCEFvN (ORCPT + 31 others); Tue, 5 Mar 2019 00:51:13 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:38856 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725782AbfCEFvN (ORCPT ); Tue, 5 Mar 2019 00:51:13 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id x255mOrT002400; Tue, 5 Mar 2019 14:48:24 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x255mOrT002400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1551764905; bh=upricv6fVewsTKjghecoorebp9rRB3J2zizg4F0dOiY=; h=From:To:Cc:Subject:Date:From; b=psm7CSLg9BijV5QYpGE7GbBhhpCAe6mQnyl8ySC3xeg5QAvvvV2LEjloeMRip4SuO 2kD4bgx5yeh6gsItH3WqMtheJsOinOTNWDSkqCaCHdapoi7PslPNlh1UyUqJQt42z3 fp0gYP6WGCbaZ7BtpQU0jH2CseNNfhqaCEdYBkjtGob5ziN5Lrq086s0RBMFlKaJWf wIsne5C7SFaF2Rrw26bvyNF2+KySQs3JU2Ckj2qIEsEEO1n2WLsH3MS+RDuw+DJ0Y0 AHoB6iwdxKKOQ2bjdDLI1Befkmb4Zqm2Ga+H85C09Z8gGDazZNktbbsBOjIZPd1CkG KeIp+b3UH59Fg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: Ingo Molnar , Josh Poimboeuf , Peter Zijlstra Cc: Thomas Gleixner , Douglas Anderson , Robin Meijboom , Borislav Petkov , "H . Peter Anvin" , x86@kernel.org, Linus Torvalds , Sam Ravnborg , linux-kbuild@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] tools: move initial declarations out of 'for' loop Date: Tue, 5 Mar 2019 14:48:14 +0900 Message-Id: <1551764896-8453-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When I was trying to compile this code for hostprogs-y notation of Kbuild, I was hit by the following error. error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode This is because KBUILD_HOSTCFLAGS specifies -std=gnu89 whereas the tools Makefile compiles it with -std=gnu99. Of course, it would be possible to pass -std=gnu99 per file, but it shouldn't hurt to fix the C code. Signed-off-by: Masahiro Yamada --- tools/lib/subcmd/parse-options.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/tools/lib/subcmd/parse-options.c b/tools/lib/subcmd/parse-options.c index dbb9efb..1bd858a2 100644 --- a/tools/lib/subcmd/parse-options.c +++ b/tools/lib/subcmd/parse-options.c @@ -630,6 +630,7 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *o const char *const subcommands[], const char *usagestr[], int flags) { struct parse_opt_ctx_t ctx; + int i; /* build usage string if it's not provided */ if (subcommands && !usagestr[0]) { @@ -637,7 +638,7 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *o astrcatf(&buf, "%s %s [] {", subcmd_config.exec_name, argv[0]); - for (int i = 0; subcommands[i]; i++) { + for (i = 0; subcommands[i]; i++) { if (i) astrcat(&buf, "|"); astrcat(&buf, subcommands[i]); @@ -663,7 +664,7 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *o exit(130); case PARSE_OPT_LIST_SUBCMDS: if (subcommands) { - for (int i = 0; subcommands[i]; i++) + for (i = 0; subcommands[i]; i++) printf("%s ", subcommands[i]); } putchar('\n');