Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1946392imn; Mon, 1 Aug 2022 06:00:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vRSxFKyhREX86hYq5eK1K1idk0WZ/JB9HZmy1HbHUAV9/sx7gD6FGUxqVsADYgDG/Ce2On X-Received: by 2002:a17:907:96a9:b0:72e:ddc3:279c with SMTP id hd41-20020a17090796a900b0072eddc3279cmr12366119ejc.138.1659358848511; Mon, 01 Aug 2022 06:00:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659358848; cv=none; d=google.com; s=arc-20160816; b=w+fDTsdHdIqP9Hj2wYIM3ANkS3fgv7xHjeo0xZweMy8Dpi6IURGPFIlgo9O1OU8rQs swcjcx28jugHVshsRuvH1Sus9vlBgNmYL5FxO/bmVq9lfEYpZZnrrgFt6A0KoFrEml9Y ujtrGSIFiP2oA/pAoT2PqgPsaB4e9PdLmXA04mU0LSC5U1r5hY9XoprJa4+1aYZcljCA Ry8lfBKpiJb36capITcy8KkwxkPRj44YGYtj61yX1X+k1uqx1kaSyS90GIqzSR0y+hc/ pIqHMSZyAWuIesNCquGW/yIQIhsYP2GtKIF1A7fSlRkYkVB92Ilgan/Ru2IaLDH8SNF7 yY/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=+mnHx9LdVMN40M4C4fKnP1Xs/r6uMgKwM2C2/VuU/yk=; b=Jv2gAEctMUCwL1EFoFj+Do8t60IelNlRFTDU2lt9Jch3+UX8PLFvMHcqNmCdu+bH3U aA65PKSP8B1s0JoNhIkLNMgcwZTiHP/3LOiIj8r5oPmgHM+dDHYaQDHK7EnxAsPuYyGa Pt264eYH+meI6RObt94O+BuoG6B37oGvn2FjfRVKfckU10rijdS2L0PkkJUjAtJlDaHm 6ESPx8jnKtTdc3fUm37f5wayZKe/baHDwwjPqgAi3fhWY/ahejueoUH5XkvNnKfKHkUz 0VrAkERFTz4iwlyDsPMl2n6Z75KIuhB3NPtQpvDUDd1wVlW1mrUTiOqH4m15K+5z3YoQ lKPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=TF5xp3nB; dkim=neutral (no key) header.i=@suse.cz header.b=6jD9TGBQ; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc37-20020a1709078a2500b0072af3e12493si11294127ejc.992.2022.08.01.06.00.01; Mon, 01 Aug 2022 06:00:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=TF5xp3nB; dkim=neutral (no key) header.i=@suse.cz header.b=6jD9TGBQ; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234846AbiHAMyE (ORCPT + 99 others); Mon, 1 Aug 2022 08:54:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235146AbiHAMxk (ORCPT ); Mon, 1 Aug 2022 08:53:40 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B4502FFC1 for ; Mon, 1 Aug 2022 05:49:36 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CA76366EC7; Mon, 1 Aug 2022 12:49:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1659358174; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+mnHx9LdVMN40M4C4fKnP1Xs/r6uMgKwM2C2/VuU/yk=; b=TF5xp3nB2WY56fOeaCb1hGtQXvsU+jl3maABxJ364YubNKsepHhMAvxmB6ZzJhvN+fnPeN ia0TCXR149YojoAX5msy+y99/olMT+AmaK+HE8MJIETe4iP9Pyyhl6DvLFczp8nMeU4eNC bQc4RTVCbfdIWAG+Mem14d/YaJr21pk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1659358174; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+mnHx9LdVMN40M4C4fKnP1Xs/r6uMgKwM2C2/VuU/yk=; b=6jD9TGBQwvXt/is39ycStrmb5V382Qa3rley0GZT0jiB9b0WuBQE7SYDcfiHlBg4beRPHW Sb8l7GmwLGDRH+BQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B02F913A72; Mon, 1 Aug 2022 12:49:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id S4qDKd7L52I5KgAAMHmgww (envelope-from ); Mon, 01 Aug 2022 12:49:34 +0000 Date: Mon, 1 Aug 2022 14:51:21 +0200 From: Cyril Hrubis To: Petr Vorel Cc: ltp@lists.linux.it, linux-nfs@vger.kernel.org, Chen Hanxiao Subject: Re: [RFC PATCH 1/1] metaparse: Replace macro also in arrays Message-ID: References: <20220729153246.1213-1-pvorel@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220729153246.1213-1-pvorel@suse.cz> X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Hi! > This helps to replace macros like: > > #define TEST_APP "userns06_capcheck" > > static const char *const resource_files[] = { > TEST_APP, > NULL, > }; > > $ ./metaparse -Iinclude -Itestcases/kernel/syscalls/utils/ ../testcases/kernel/containers/userns/userns06.c > Before: > "resource_files": [ > "TEST_APP" > ], > ... > > After: > "resource_files": [ > "userns06_capcheck" > ], > ... > > Signed-off-by: Petr Vorel > --- > Hi all, > > This is a reaction on patch > https://patchwork.ozlabs.org/project/ltp/patch/20220722083529.209-1-chenhx.fnst@fujitsu.com/ > First: I was wrong, inlining arrays does any change in the docparse output. > BTW I'd be still for inlining for better readability. > > I'm not sure if this is not good idea, maybe some of the constants should be > kept unparsed, e.g.: > > Orig: > "caps": [ > "TST_CAP", > "(", > "TST_CAP_DROP", > "CAP_SYS_RESOURCE", > > Becomes: > "caps": [ > "TST_CAP", > "(", > "TST_CAP_DROP", > "24", > > CAP_SYS_RESOURCE is replaced because it's a string, but IMHO it'd be better to keep it. > TST_CAP{_DROP,} aren't replaced because they aren't a plain strings. > Maybe replace only non-numerc values? That really depends on the context, we do have many cases where we have a macro that expands to numeric that should be expanded, runtime would be one of the prime examples of that. I guess that the only solution would be an explicit list of macro prefixes that should not be expanded, e.g. do not expand if macro starts with "CAP_". -- Cyril Hrubis chrubis@suse.cz