[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v2 1/4] build,include: rework shell script for headers++.chk


  • To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 15 Jun 2022 12:44:17 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3zB8A7BFijukqjC6xGoPOJL5l8xfeQLWHlypK/IB/54=; b=FrMmb49zsUHUvun1gPsplG6j6WONqH7hNQXKkymD3rmwHekyVU/nMKo2nlbA0HGVtXMQApWFqfZshxUqmvnG5qf9n54j2D1wIzLTTskcNA0gY3pUyEbpnnRFYVcdnfFr3h6cmFnPi3VGSEMvo6c5mcqlGddrT7gN1cp2XfuzKMwqoxh5AEAUDwds9jfZMFyByj65XjY/UZO69MENlytuVE/nsUW6OGUsQW2PXueEZLbAevyzPgALYPihh2m3eQSVZ3wMM4Uf5JnHlqpO/gcKp0bFrRSnO7URx0RfWsr3dr4+o/1iI7vl41kYrltYoLprfGLC0Jri0TqStYhbC+6bWQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NwPRmMNlK2HqHB32EXPCjhsskkJVbcPWTLnXRzfVvl2/UG+ft+pE3Op9bvsSXibJyaWdqGCkGFPhgaKCOTQ7hzbVXervknlQiBrz30h52h61z8ElOA7iWnQAWKXpHJOB+SAFEAoOsfLqdeETD8ASQ88oc0QJO1Jsic6zGktuwGDaf2ajEbt2MW/vBC9hLY31zID9zfPABQwYWuIAXce9gEkO+KJyjvZYcdRaQGpYRQZlDbIWPe/riCIh7MnJj15LzVg8rirezWl8/AKEuBg3Yg6C/CyrA6omCnuCxM0hYVK6Gn29AqKHaAg2n+Gx7fSpcu7d5DVaIbNCxg2YLM3csw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 15 Jun 2022 10:44:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 15.06.2022 12:31, Anthony PERARD wrote:
> On Wed, Jun 15, 2022 at 08:37:42AM +0200, Jan Beulich wrote:
>> On 14.06.2022 18:22, Anthony PERARD wrote:
>>> diff --git a/xen/include/Makefile b/xen/include/Makefile
>>> index 6d9bcc19b0..49c75a78f9 100644
>>> --- a/xen/include/Makefile
>>> +++ b/xen/include/Makefile
>>> @@ -158,13 +158,22 @@ define cmd_headerscxx_chk
>>>         touch $@.new;                                                     \
>>>         exit 0;                                                           \
>>>     fi;                                                                   \
>>> -   $(foreach i, $(filter %.h,$^),                                        \
>>> -       echo "#include "\"$(i)\"                                          \
>>> +   get_prereq() {                                                        \
>>> +       case $$1 in                                                       \
>>> +       $(foreach i, $(filter %.h,$^),                                    \
>>> +       $(if $($(patsubst $(srctree)/%,%,$(i))-prereq),                   \
>>> +           $(i)$(close)                                                  \
>>> +           echo "$(foreach j, $($(patsubst $(srctree)/%,%,$(i))-prereq), \
>>> +                   -include c$(j))";;))                                  \
>>> +       esac;                                                             \
>>
>> If I'm reading this right (indentation looks to be a little misleading
>> and hence one needs to count parentheses) the case statement could (in
>> theory) remain without any "body". As per the command language spec I'm
>> looking at this (if it works in the first place) is an extension, and
>> formally there's always at least one label required. Since we aim to be
>> portable in such regards, I'd like to request that there be a final
>> otherwise empty *) line.
> 
> When looking at the shell grammar at [1], an empty body seems to be
> allowed. But I can add "*)" at the end for peace of mind.
> 
> [1] 
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_10_02

Hmm, indeed. As opposed to

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_04

> As for misleading indentation, I've got my $EDITOR to show me matching
> parentheses, so I don't need to count them. But if I rewrite that
> function as following, would it be easier to follow?
> 
> +     get_prereq() {                                                        \
> +     case $$1 in                                                           \
> +     $(foreach i, $(filter %.h,$^),                                        \
> +         $(if $($(patsubst $(srctree)/%,%,$(i))-prereq),                   \
> +             $(i)$(close)                                                  \
> +             echo "$(foreach j, $($(patsubst $(srctree)/%,%,$(i))-prereq), \
> +                     -include c$(j))";;))                                  \
> +     *) ;;                                                                 \
> +     esac;                                                                 \
> +     };                                                                    \

Hmm, not really, no (and it may be more obvious looking at the reply
context above): My primary concern is the use of hard tabs beyond the
leading one (which is uniform across all lines and hence doesn't alter
apparent alignment even with the + or > prefixed).

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.