From patchwork Tue Apr 5 05:41:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Christophe PLAGNIOL-VILLARD X-Patchwork-Id: 686111 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p355tkbr007269 for ; Tue, 5 Apr 2011 05:55:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750876Ab1DEFzo (ORCPT ); Tue, 5 Apr 2011 01:55:44 -0400 Received: from 63.mail-out.ovh.net ([91.121.185.56]:41866 "HELO 63.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1750840Ab1DEFzo (ORCPT ); Tue, 5 Apr 2011 01:55:44 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 05 Apr 2011 05:55:47 +0000 (UTC) X-Greylist: delayed 400 seconds by postgrey-1.27 at vger.kernel.org; Tue, 05 Apr 2011 01:55:44 EDT Received: (qmail 24677 invoked by uid 503); 5 Apr 2011 06:37:42 -0000 Received: from b6.ovh.net (HELO mail610.ha.ovh.net) (213.186.33.56) by 63.mail-out.ovh.net with SMTP; 5 Apr 2011 06:37:42 -0000 Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 5 Apr 2011 07:49:03 +0200 Received: from ns32433.ovh.net (HELO localhost) (plagnioj%jcrosoft.com@213.251.161.87) by ns0.ovh.net with SMTP; 5 Apr 2011 07:49:01 +0200 From: Jean-Christophe PLAGNIOL-VILLARD To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jean-Christophe PLAGNIOL-VILLARD Subject: [RFC/PATCH] kconfig: autogenerated is_config_xxx macro Date: Tue, 5 Apr 2011 07:41:23 +0200 Message-Id: <1301982083-23873-1-git-send-email-plagnioj@jcrosoft.com> X-Mailer: git-send-email 1.7.2.3 X-Ovh-Tracer-Id: 12487637342155483986 X-Ovh-Remote: 213.251.161.87 (ns32433.ovh.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|U 0.5/N Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org this will allow to use to use if(is_config_xxx()) in the code instead of #ifdef CONFIG_xxx and now let the compiler remove the non usefull code and not the pre-processor as done in the mach-types for arm as exmaple Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- scripts/kconfig/confdata.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 61c35bf..5ea8739 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -778,6 +778,28 @@ out: return res; } +static void conf_write_function_autoconf(FILE *out, char* conf, char* name, int val) +{ + char c; + char *tmp, *d; + + *d = strdup(conf); + tmp = d; + while ((c = *conf++)) { + *d++ = tolower(c); + } + fprintf(out, "#define is_%s", tmp); + free(tmp); + + d = strdup(name); + tmp = d; + while ((c = *name++)) { + *d++ = tolower(c); + } + fprintf(out, "%s() %d\n", tmp, val); + free(tmp); +} + int conf_write_autoconf(void) { struct symbol *sym; @@ -786,6 +808,7 @@ int conf_write_autoconf(void) FILE *out, *tristate, *out_h; time_t now; int i; + int fct_val; sym_clear_all_valid(); @@ -829,6 +852,7 @@ int conf_write_autoconf(void) rootmenu.prompt->text, ctime(&now)); for_all_symbols(i, sym) { + fct_val = 1; sym_calc_value(sym); if (!(sym->flags & SYMBOL_WRITE) || !sym->name) continue; @@ -842,6 +866,7 @@ int conf_write_autoconf(void) case S_TRISTATE: switch (sym_get_tristate_value(sym)) { case no: + fct_val = 0; break; case mod: fprintf(tristate, "%s%s=M\n", @@ -874,8 +899,10 @@ int conf_write_autoconf(void) CONFIG_, sym->name, str); break; default: + fct_val = 0; break; } + conf_write_function_autoconf(out_h, CONFIG_, sym->name, fct_val); } fclose(out); fclose(tristate);