From patchwork Fri Apr 13 05:06:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 133333 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp347313ljb; Thu, 12 Apr 2018 22:13:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/DrJCQDGnyn5dCNW3fSOsxrOWSnefufd6t6q26O/q0rdrgJxgWNRIZqPbie3IwyWCK2vkC X-Received: by 10.98.68.86 with SMTP id r83mr10206586pfa.145.1523596393114; Thu, 12 Apr 2018 22:13:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523596393; cv=none; d=google.com; s=arc-20160816; b=W1zuZKqLrn0Qa0uNH7paCFNi7rbvxab1eQjDWx3ewPd4OwchiwRX5OBwgq8Gaw4vpo 4igWDiMy6/rzxW29dpl7nN6DDrHfRiyAfOnrW0msBCLse86gFdeAatXQT6eFVUZr4feE 62yESfMyxrJdu52Pgkw9Gc5eXWhOj0fe5obdAOBjnNSNY6A0WHVW52iknvQxRY+uZbo/ 9vSUG9/QVD1cRQkka8qpoKh7ZSfg8DG0GRvAtmSikBUysbTz9dabgKdF7levZ5jyCg68 Gks2c0Pb/UTp2SKxS/us7j/XbRqr70if6AhuyM0ss7mq6adoH7DFFhkwINzYc2fhlfcT Bq0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=IL2qlncW5ohyiKFKEs34ce6mwrxe9/okwLRsL2ZRwwQ=; b=tPc7n07SuI6xkVVMq7tqIa1Pdv/2aWRz1ngBLgT7vFP0nY1AHd+1LSZKEdd0YbNffN jIXG2oWTqe9TL/cti6Z5nwayVLX5KG79PZdmpf9yfPPiZF9coKxh5fXTGUyU8tOFWpJ0 LCLfPO1OV41Tk90XFXBpAsiAKmKG1xZVPDwlb7iwp/GKmkKxsDOzdBcR/nzxwHYuiYt0 DTfEsHqLz7l1hn0SbOB6JdUUbjF8GhvahzTmQxVtee5VdfXJAXgrnUgYX5JVbdoUv2CT rSNpjyLOJkWTCmaILs914zI5QyywPSlyczhXxP/PpJqYmMLM2vP7O7/sNmXooEo/rgcd uF6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=LeWW7d1W; 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 m3-v6si4876988pld.351.2018.04.12.22.13.12; Thu, 12 Apr 2018 22:13:13 -0700 (PDT) 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=LeWW7d1W; 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 S1753945AbeDMFMp (ORCPT + 29 others); Fri, 13 Apr 2018 01:12:45 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:54506 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751047AbeDMFIQ (ORCPT ); Fri, 13 Apr 2018 01:08:16 -0400 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 w3D56lgA029209; Fri, 13 Apr 2018 14:07:02 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w3D56lgA029209 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1523596022; bh=IL2qlncW5ohyiKFKEs34ce6mwrxe9/okwLRsL2ZRwwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LeWW7d1WAwqRbKQo+AYacNDw8Hu9vA/QEYYgkwqppxPhTRsIdzJeX2cbN8cSSATEK u6ov96WlFLLpR4au01XwX0JNtH+j5ntHOY0SLUePKzOHH/Ef+NH+Gh2LaOw8ujwigs dTxxXRjPWnW0pCHR/5GQOzty+lK2KvGNuLIj0Fv2yWNkxB3H+NT4a+HPTx+Usfy9mX jHBAR9w9P60r34FrJcSbFVO03lVImj1bF+8Bwby/DDpcNMVLwQBsT7u+REWGRsEfCu 24s+tv8xPCODrVT96WhwMRplw83t25PDBONiVHIU553YBvIGGHAJ6oLDVxONimpTAL vVwQ5K8/flykg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Linus Torvalds , Sam Ravnborg , Ulf Magnusson , Nicholas Piggin , Kees Cook , Emese Revfy , x86@kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 16/30] kconfig: add 'info' and 'warning' built-in functions Date: Fri, 13 Apr 2018 14:06:25 +0900 Message-Id: <1523595999-27433-17-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523595999-27433-1-git-send-email-yamada.masahiro@socionext.com> References: <1523595999-27433-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add 'info' and 'warning' functions as in Make. They print messages during parsing Kconfig files, which is useful when debugging Kconfig at least. Signed-off-by: Masahiro Yamada --- Changes in v3: None Changes in v2: None scripts/kconfig/preprocess.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) -- 2.7.4 diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c index 85972fb..f8d06d9 100644 --- a/scripts/kconfig/preprocess.c +++ b/scripts/kconfig/preprocess.c @@ -203,6 +203,19 @@ static char *join_args(int argc, char *argv[]) return out; } +static char *do_info(int argc, char *argv[]) +{ + char *msg; + + msg = join_args(argc, argv); + + printf("%s\n", msg); + + free(msg); + + return xstrdup(""); +} + static char *do_shell(int argc, char *argv[]) { FILE *p; @@ -244,8 +257,23 @@ static char *do_shell(int argc, char *argv[]) return xstrdup(buf); } +static char *do_warning(int argc, char *argv[]) +{ + char *msg; + + msg = join_args(argc, argv); + + fprintf(stderr, "%s:%d: %s\n", current_file->name, yylineno, msg); + + free(msg); + + return xstrdup(""); +} + static const struct function function_table[] = { + { .name = "info", .func = do_info }, { .name = "shell", .func = do_shell }, + { .name = "warning", .func = do_warning }, }; static char *function_call(const char *name, int argc, char *argv[])