From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cantor2.suse.de ([195.135.220.15]:47826 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753778Ab1EIIwl (ORCPT ); Mon, 9 May 2011 04:52:41 -0400 Message-ID: <4DC7AB57.9050002@suse.cz> Date: Mon, 09 May 2011 10:52:39 +0200 From: Michal Marek MIME-Version: 1.0 Subject: Re: [PATCH v2] kconfig: autogenerated config_is_xxx macro References: <1304658229-30820-1-git-send-email-plagnioj@jcrosoft.com> <20110507015041.GA21017@game.jcrosoft.org> In-Reply-To: <20110507015041.GA21017@game.jcrosoft.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kbuild-owner@vger.kernel.org List-ID: To: Jean-Christophe PLAGNIOL-VILLARD Cc: Arnaud Lacombe , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org On 7.5.2011 03:50, Jean-Christophe PLAGNIOL-VILLARD wrote: > On 12:19 Fri 06 May , Arnaud Lacombe wrote: >> Why would it be a good thing ? >> >> Most configuration-dependent code inside functions tends to be moved >> to a static inline already, which get conditionally defined based on >> the CONFIG_. If it is not, then the code is badly architectured >> (-> bad). Using that if(xxx) notation would also lead to yet more >> heavily indented function (-> bad). Moreover, this introduces >> yet-another way to check for an information (-> bad), and you will end >> up with mixing the config_is_ notation inside a function >> declaration, and CONFIG_ when not inside a function (-> bad) >> >> Actually, this is even worse than that as you'll not be able to hide >> structure (or structure members) inside CONFIG_ and use that >> structure (or structure members) in config_is_ protected block >> without causing compile-time failure. > sorry but conditionnal structure members is bad practice > you save nearly no space nut for the test of the code in multiple > configuration. Use union for this. > > the compile-time failure is good here. it's means your code is not generic. > > specially when you want to keep code running on multiple soc/arch keep compiling > no matter the configuration > > #ifdef in the code is a really bad habit Do you have proof of concept patches that make use of the config_is_xxx macros? Acked by the respective subsystem maintainers? It would be a good idea to send them along to show that this feature is going to be actually used. Michal