From patchwork Sun Aug 14 17:02:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Lacombe X-Patchwork-Id: 1066092 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7EH2aoA028199 for ; Sun, 14 Aug 2011 17:02:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753851Ab1HNRCf (ORCPT ); Sun, 14 Aug 2011 13:02:35 -0400 Received: from mail-gx0-f174.google.com ([209.85.161.174]:57874 "EHLO mail-gx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753651Ab1HNRCe (ORCPT ); Sun, 14 Aug 2011 13:02:34 -0400 Received: by gxk21 with SMTP id 21so2847240gxk.19 for ; Sun, 14 Aug 2011 10:02:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=WIGprmfoqKzwO6t6v7P65iWzeqYO//cC5XAHENwAzt4=; b=n+eQACmYVJs1nyiyfM/GTF+g9aoPI7qYFcnZiw2T6RTNNoZnJaZNrYa7QZYoJTosLw eowNULdLSEYYQzry1kZaYJsZJxxH53Zu4GUqiICsSF4HAXLJL4/S0+CR6KeftPdRuDvf 8LREoXCmvgIaKaGO9Wog1hCwomHYb4CGnB9sw= Received: by 10.236.80.4 with SMTP id j4mr10028918yhe.17.1313341354174; Sun, 14 Aug 2011 10:02:34 -0700 (PDT) Received: from localhost.localdomain (69-165-142-232.dsl.teksavvy.com [69.165.142.232]) by mx.google.com with ESMTPS id c63sm2463540yhe.18.2011.08.14.10.02.32 (version=SSLv3 cipher=OTHER); Sun, 14 Aug 2011 10:02:33 -0700 (PDT) From: Arnaud Lacombe To: Rabin Vincent Cc: Michal Marek , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Arnaud Lacombe Subject: Re: IS_ENABLED() and non-available symbols Date: Sun, 14 Aug 2011 13:02:26 -0400 Message-Id: <1313341346-15605-1-git-send-email-lacombar@gmail.com> X-Mailer: git-send-email 1.7.6.153.g78432 In-Reply-To: References: Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sun, 14 Aug 2011 17:02:36 +0000 (UTC) Hi, On Sun, Aug 14, 2011 at 12:55 PM, Arnaud Lacombe wrote: > The solution is trivial, but I am not sure we want to go that way: we > need to generated a __enabled_ entry for symbols for _all_ symbols in > the configuration, even internal one > That should do the job... -= NOT FOR MERGE =- Not-Signed-off-by: Arnaud Lacombe --- scripts/kconfig/confdata.c | 42 +++++++++++++++++++++++++++++++----------- 1 files changed, 31 insertions(+), 11 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 59b667c..e976ccb 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -503,17 +503,6 @@ header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) fprintf(fp, "#define %s%s%s 1\n", CONFIG_, sym->name, suffix); } - /* - * Generate the __enabled_CONFIG_* and - * __enabled_CONFIG_*_MODULE macros for use by the - * IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is - * generated even for booleans so that the IS_ENABLED() macro - * works. - */ - fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n", - sym->name, (*value == 'y')); - fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n", - sym->name, (*value == 'm')); break; } case S_HEX: { @@ -565,6 +554,35 @@ static struct conf_printer header_printer_cb = }; /* + * Generate the __enabled_CONFIG_* and __enabled_CONFIG_*_MODULE macros for + * use by the IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is + * generated even for booleans so that the IS_ENABLED() macro works. + */ +static void +header_print__enabled_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) +{ + + switch (sym->type) { + case S_BOOLEAN: + case S_TRISTATE: { + fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n", + sym->name, (*value == 'y')); + fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n", + sym->name, (*value == 'm')); + break; + } + default: + break; + } +} + +static struct conf_printer header__enabled_printer_cb = +{ + .print_symbol = header_print__enabled_symbol, + .print_comment = header_print_comment, +}; + +/* * Tristate printer * * This printer is used when generating the `include/config/tristate.conf' file. @@ -945,6 +963,8 @@ int conf_write_autoconf(void) conf_write_heading(out_h, &header_printer_cb, NULL); for_all_symbols(i, sym) { + conf_write_symbol(out_h, sym, &header__enabled_printer_cb, NULL); + sym_calc_value(sym); if (!(sym->flags & SYMBOL_WRITE) || !sym->name) continue;