Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752771AbbKZIF5 (ORCPT ); Thu, 26 Nov 2015 03:05:57 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:20250 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751968AbbKZIFy (ORCPT ); Thu, 26 Nov 2015 03:05:54 -0500 Message-ID: <5656BD42.5000703@huawei.com> Date: Thu, 26 Nov 2015 16:05:22 +0800 From: "Wangnan (F)" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: =?UTF-8?B?5bmz5p2+6ZuF5bezIC8gSElSQU1BVFXvvIxNQVNBTUk=?= , "acme@kernel.org" CC: "lizefan@huawei.com" , "pi3orama@163.com" , "linux-kernel@vger.kernel.org" , Alexei Starovoitov , Arnaldo Carvalho de Melo , Namhyung Kim Subject: Re: [PATCH 1/2] perf tools: Always give options even it not compiled References: <20151117124224.GH22729@kernel.org> <1447941793-118639-1-git-send-email-wangnan0@huawei.com> <1447941793-118639-2-git-send-email-wangnan0@huawei.com> <50399556C9727B4D88A595C8584AAB3752627CD4@GSjpTKYDCembx32.service.hitachi.net> In-Reply-To: <50399556C9727B4D88A595C8584AAB3752627CD4@GSjpTKYDCembx32.service.hitachi.net> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.5656BD54.0099,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 1a38090f5c6d12563985d9e6ceee587d Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2132 Lines: 62 On 2015/11/20 18:54, 平松雅巳 / HIRAMATU,MASAMI wrote: >> From: Wang Nan [mailto:wangnan0@huawei.com] >> >> This patch keeps options of perf builtins same in all condition. If the >> option is disabled because of compiling options, users should be >> notified. >> >> This patch does it by introducing a series of new option macros, flags >> and field in struct options. For those options disabled by compiling, >> OPT_NOTBUILT_NOARG, OPT_NOTBUILT_OPTARG and OPT_NOTBUILT can be used >> to record the help messages and the reason why not built them. >> >> Options in 'perf record' and 'perf probe' are fixed by those new macros. > Hmm, OK, I agree the reason why this is useful. Could you reconsider > the implementation, because just cloning the code is ugly and not > maintainable? > > It will be better if we can replace OPT_BOOLEAN with; > > OPT_DEPENDS(HAVE_DWARF_SUPPORT, BOOLEAN, '\0', "no-inlines", &probe_conf.no_inlines, ... > > This may be done by following macros ; > > ---- > #define OPTMSG_HAVE_DWARF_SUPPORT "NO_DWARF" > #ifdef HAVE_DWARF_SUPPORT > #define OPTVAL_HAVE_DWARF_SUPPORT 1 > #else > #define OPTVAL_HAVE_DWARF_SUPPORT 0 > #endif > > #define __OPT_DEPENDS(val, msg, opt, ...) \ > {.type = OPTION_NEXT_DEPENDS, .value = (void *)val, .data = msg, }, opt(__VA_ARGS__) > > #define _OPT_DEPENDS(val, msg, opt, ...) \ > __OPT_DEPENDS(val, msg, opt, __VA_ARGS__) > > #define OPT_DEPENDS(flag, opt, ...) \ > _OPT_DEPENDS(OPTVAL_ ## flag, OPTMSG_ ## flag, OPT_ ## opt, __VA_ARGS__) > ---- > > And if the parser find OPTION_NEXT_DEPENDS and .value != NULL, it skips next entry. > That would be good, but don't forget we have a options__order() which reorder the options array. To archive our goal I think we must preprocess the options array to 'merge' information in the OPTION_NEXT_DEPENDS into the real option it decorates. Thank you. > Thank you, > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/