All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Ákos Kovács" <akoskovacs@gmx.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 01/47] rules.mak: New logical functions
Date: Fri, 13 Sep 2013 16:55:29 +0200	[thread overview]
Message-ID: <52332761.8090903@redhat.com> (raw)
In-Reply-To: <CAFEAcA_=qt+KX-ArGoqjjDEqj8YR--1H-LSSCLiodWKzNR3rKA@mail.gmail.com>

Il 13/09/2013 15:43, Peter Maydell ha scritto:
> On 25 August 2013 23:58, Ákos Kovács <akoskovacs@gmx.com> wrote:
>> lnot, land, lor, lif, eq, ne, isempty, notempty functions added
>> Example usage:
>>     obj-$(call lor,$(CONFIG_LINUX),$(CONFIG_BSD)) += feature.o
>>
>> Signed-off-by: Ákos Kovács <akoskovacs@gmx.com>
> 
> Hi; I like the general idea here but I think there
> are some issues with your implementation.
> 
>> ---
>>  rules.mak |   16 ++++++++++++++++
>>  1 file changed, 16 insertions(+)
>>
>> diff --git a/rules.mak b/rules.mak
>> index 4499745..7e8e3bd 100644
>> --- a/rules.mak
>> +++ b/rules.mak
>> @@ -106,6 +106,22 @@ clean: clean-timestamp
>>  obj := .
>>  old-nested-dirs :=
>>
>> +# Logical functions
> 
> I think we should be clear here about the input
> and output ranges of these functions, ie that
> the inputs should always be "y", "n" or "" (with
> either "n" or the empty string being false).
> 
>> +lnot = $(if $(subst n,,$1),n,y)
>> +
>> +land-yy = y
>> +land = $(land-$1$2)
> 
> This means that $(call land,y,n) would expand
> to the empty string, not 'y' or 'n', right?
> I think we should make all these functions always
> expand to either 'y' or 'n'.
> 
> land = $(if $(findstring yy,$1$2),y,n)
> 
> will do this.
> 
>> +lor = $(if $(subst $2,,$1)$(subst $1,,$2),n,y)
> 
> This can't be correct for both 'lor' and 'eq'.
> In fact it works as 'eq'. A working lor would be:
> 
> lor = $(if $(findstring y,$1$2),y,n)
> 
>> +lif = $(if $(subst n,,$1),$2,$3)
>> +
>> +eq = $(if $(subst $2,,$1)$(subst $1,,$2),n,y)
>> +ne = $(if $(subst $2,,$1)$(subst $1,,$2),y,n)
> 
> These give the wrong answer for comparisons
> of 'n' with ''. Working versions:
> 
> eq = $(if $(filter $(call lnot,$1),$(call lnot,$2)),y,n)
> ne = $(if $(filter $(call lnot,$1),$(call lnot,$2)),n,y)

isempty/notempty are clearly string functions, where only the output is
of the y/n form.  Seeing Akos's implementation of isempty/notempty, I
think the desired semantics for eq/ne/isempty/notempty are also those of
string functions.

I would call your functions leqv/lxor, not eq/ne.

Your patch is fine if you either rename eq/ne like this, or revert them
to Akos's version.

Paolo

>> +isempty = $(call eq,$1,)
>> +notempty = $(call ne,$1,)
> 
> These are wrong assuming we want 'n' eq '' semantics,
> and we can directly implement them with $if anyway:
> 
> isempty = $(if $1,n,y)
> notempty = $(if $1,y,n)

  reply	other threads:[~2013-09-13 14:55 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-25 22:58 [Qemu-devel] [RFC PATCH 00/47] Describing patchset Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 01/47] rules.mak: New logical functions Ákos Kovács
2013-09-13 13:43   ` Peter Maydell
2013-09-13 14:55     ` Paolo Bonzini [this message]
2013-09-13 15:02       ` Peter Maydell
2013-09-13 15:12         ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 02/47] Makefile.target: CONFIG_NO_* variables removed Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 03/47] default-configs/: CONFIG_GDBSTUB_XML removed Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 04/47] scripts/kconfig: kconfig-frontends submodule added Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 05/47] Makefile: Clone kconfig git submodule in Makefile Ákos Kovács
2013-08-26  2:33   ` Andreas Färber
2013-08-25 22:58 ` [Qemu-devel] [PATCH 06/47] hw/alpha/Makefile.objs: Build objects depending on CLIPPER Ákos Kovács
2013-08-26 14:41   ` Richard Henderson
2013-08-26 16:59     ` Paolo Bonzini
2013-08-26 17:30       ` Richard Henderson
2013-08-26 18:44         ` Lluís Vilanova
2013-08-26 19:47           ` Peter Maydell
2013-08-26 22:44             ` Paolo Bonzini
2013-08-26 22:33         ` Paolo Bonzini
2013-08-26 22:49           ` Richard Henderson
2013-08-26 23:17           ` Peter Maydell
2013-08-27  6:59             ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 07/47] hw/arm/Makefile.objs: CONFIG_* created for each board Ákos Kovács
2013-08-25 23:57   ` Max Filippov
2013-08-26 10:42   ` Peter Maydell
2013-08-25 22:58 ` [Qemu-devel] [PATCH 09/47] hw/m68k/Makefile.objs: Conditionally build boards Ákos Kovács
2013-08-26  0:09   ` Max Filippov
2013-08-25 22:58 ` [Qemu-devel] [PATCH 10/47] hw/microblaze/Makefile.objs: Create configs for petalogix boards Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 11/47] hw/mips/Makefile.objs: Create CONFIG_* for mips boards Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 12/47] hw/ppc/Makefile.objs: Build all boards conditinally Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 13/47] hw/sh4/Makefile.objs: Build sh4 boards conditionally Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 14/47] hw/sparc/Makefile.objs: CONFIG_* for sun4m and leon3 created Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 15/47] hw/lm32/Makefile.objs: Conditionally build lm32 and milkmyst Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 16/47] hw/xtensa/Makefile.objs: Build xtensa_sim and xtensa_lx60 conditionally Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 17/47] hw/9pfs/Kconfig: Add 9pfs Kconfig Ákos Kovács
2013-08-26 10:39   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 18/47] hw/arm/Kconfig: Add ARM Kconfig Ákos Kovács
2013-08-26 10:38   ` Peter Maydell
2013-08-26 11:09   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 19/47] hw/audio/Kconfig: Add audio Kconfig Ákos Kovács
2013-08-26 10:41   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 20/47] hw/block/Kconfig: Add Kconfig file Ákos Kovács
2013-08-26 10:43   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 21/47] hw/char/Kconfig: " Ákos Kovács
2013-08-26 10:43   ` Paolo Bonzini
2013-08-26 17:15     ` Andreas Färber
2013-08-26 22:40       ` Paolo Bonzini
2013-09-13 14:00         ` Andreas Färber
2013-09-13 14:49           ` Paolo Bonzini
2013-09-15 10:43             ` Alberto Garcia
2013-08-25 22:58 ` [Qemu-devel] [PATCH 22/47] hw/core/Kconfig: " Ákos Kovács
2013-08-26 10:45   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 23/47] hw/cpu/Kconfig: " Ákos Kovács
2013-08-26 17:03   ` Andreas Färber
2013-08-25 22:58 ` [Qemu-devel] [PATCH 24/47] hw/display/Kconfig: " Ákos Kovács
2013-08-26 10:49   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 25/47] hw/dma/Kconfig: " Ákos Kovács
2013-08-26 10:49   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 26/47] hw/gpio/Kconfig: " Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 27/47] hw/i2c/Kconfig: " Ákos Kovács
2013-08-26 10:50   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 28/47] hw/ide/Kconfig: " Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 29/47] hw/input/Kconfig: " Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 30/47] hw/intc/Kconfig: " Ákos Kovács
2013-08-26 10:53   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 31/47] hw/isa/Kconfig: " Ákos Kovács
2013-08-26 11:03   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 32/47] hw/misc/Kconfig: " Ákos Kovács
2013-08-26 11:00   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 33/47] hw/net/Kconfig: " Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 34/47] hw/nvram/Kconfig: " Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 35/47] hw/pci/Kconfig: " Ákos Kovács
2013-08-26 11:01   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 36/47] hw/pci-bridge/Kconfig: " Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 37/47] hw/pci-host/Kconfig: " Ákos Kovács
2013-08-26 11:02   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 38/47] hw/scsi/Kconfig: " Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 39/47] hw/sd/Kconfig: " Ákos Kovács
2013-08-26 11:05   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 40/47] hw/ssi/Kconfig: " Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 41/47] hw/timer/Kconfig: " Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 42/47] hw/tpm/Kconfig: " Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 43/47] hw/usb/Kconfig: " Ákos Kovács
2013-08-26 11:06   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 44/47] hw/watchdog/Kconfig: " Ákos Kovács
2013-08-26 11:06   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 45/47] hw/Kconfig: Add the main Kconfig for hw/ Ákos Kovács
2013-08-25 22:58 ` [Qemu-devel] [PATCH 46/47] configure: Generate Kconfig.targets with --target-list Ákos Kovács
2013-08-26 11:14   ` Paolo Bonzini
2013-08-25 22:58 ` [Qemu-devel] [PATCH 47/47] Kconfig: Main kconfig file added Ákos Kovács
2013-08-26  7:35 ` [Qemu-devel] [RFC PATCH 00/47] Describing patchset Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52332761.8090903@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=akoskovacs@gmx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.