From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.zytor.com (terminus.zytor.com [198.137.202.10]) by dpdk.org (Postfix) with ESMTP id 807BA159 for ; Mon, 24 Mar 2014 17:09:46 +0100 (CET) Received: from hanvin-mobl6.amr.corp.intel.com ([192.55.55.41]) (authenticated bits=0) by mail.zytor.com (8.14.7/8.14.5) with ESMTP id s2OGBHup009500 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 24 Mar 2014 09:11:18 -0700 Message-ID: <53305920.7000206@zytor.com> Date: Mon, 24 Mar 2014 09:11:12 -0700 From: "H. Peter Anvin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Neil Horman References: <1395333868-2808-1-git-send-email-hpa@linux.intel.com> <532B1F79.1050308@zytor.com> <20140324160647.GF19368@hmsreliant.think-freely.org> In-Reply-To: <20140324160647.GF19368@hmsreliant.think-freely.org> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, "H. Peter Anvin" Subject: Re: [dpdk-dev] [RFC UNTESTED PATCH] eal_common_cpuflags: Fix %rbx corruption, and simplify the code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Mar 2014 16:09:47 -0000 On 03/24/2014 09:06 AM, Neil Horman wrote: >> >> If C99-style initializers are permitted in this codebase, I would >> strongly recommend using them, and then drop the enum field in struct >> feature_entry and use a macro such as: >> > Actually, its a bit simpler than that, the enum parameter is actually completely > unused, and so can be removed entirely. The FEAT_DEF macro does what you > suggest below already, but only for the feature and name fields. > > I'll remove the enum and its definition, and augment the macro to cover the rest > of the fields. > > Neil > >> #define FEAT(name,leaf,subleaf,reg,bit) \ >> [RTE_CPUFLAG_##f] = { leaf, subleaf, reg, bit, #f }, >> >> (I'd move the string to the end, but that is just a microoptimization. >> I'm kind of OCD that way.) >> The nice thing with the C99 initializer is that even if the order is mismatched between the .c file and the .h file which defines the enum, things still work correctly. -hpa