Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1875338lqo; Sun, 19 May 2024 02:51:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJovb0MfN7zWF14rBGzZ/IuWkLHQ3xpEkvA9ylVQne6mDGRp2RnXqYFmTOKUYZjW36daeQVi41rzNs/aXXhvFq0MbgtJiWrJM6c3Kh9g== X-Google-Smtp-Source: AGHT+IE9HKIjNHtUFdfzjOOC5Kiqp1tq31+cw1duo/kiIAzNfTy7K4dRk47Hm+QS6txoRgiI/SbG X-Received: by 2002:a05:6a20:7faa:b0:1ad:1168:a417 with SMTP id adf61e73a8af0-1afde0e6b67mr38181660637.28.1716112280156; Sun, 19 May 2024 02:51:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716112280; cv=pass; d=google.com; s=arc-20160816; b=r9sm1UMxe3XVsRuQRYHrPOV5azv53m97abE9Ld1JxTl1mDduzP9bTeMIsNUWcjFm1U VgGixIRimunh9Dkas4eutLV/jqFxLzGLbedriPL41MwSMuN2g4H25rnyCK6HfIaNjcAg 2LaqcFKx3oDjmxHQdz1C+y95wllawye1mQbyMeooPnZ2s+Diktt8/oob3jAm8U5/PEWC Ig2wWzkdORL0wUgeLXHPWNwp2oDsWJMaC91Ip/dbsUeXBM+CsEvUHF9dRc0PZ2F8hm3O 924Ak6f1VcIieS70YM6X3zkfsrtltl8uG0BfEobmiwwkETbWifQnx/FmDBTkENzhHqPa AqKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=+tPNc0SRX9dTByvo2KmPlhE/0ZJ/t4Pd1ZrSzpsczZ0=; fh=ylp6aOiOQEO3Xr6ahu6Cr0U2TzbmfGS8zORDX2r6hbQ=; b=nkMTWSejTDm3ZD8Y7AqetQcE3y3eHMpsTSIJ+cze7S4LZ1qR/ZvQ0kvoM431kvuH0y s6Ta8CkzAqQK6tx/Nu192qJycRJUdXcV6cpUt3JLoNdB4cBjqLAsN3A+rWHNCoamVtEq rM9BezTGjs3KxKHVkz8j92EUcmW5iPRKJ6C9+IrpLJEqCmVp8ek2JA24u2zxd7tubMxi tXjjrQejPBm4/369vdCqbA8NcNX/5cvWHkd6LIJIFA4A3eA+LlS5DXLuPbjqH9bDS6HY 5IAgXYhgJik8xqf9sNYcktzQxaR32/7/pVWvxLFhjl9hCOzkZy04B0C08IADXDLmUNtU DVcA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bYOEMXai; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-183082-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183082-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f4d2b5146fsi861259b3a.390.2024.05.19.02.51.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 May 2024 02:51:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183082-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bYOEMXai; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-183082-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183082-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 694FCB211F2 for ; Sun, 19 May 2024 09:51:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 245A42BB13; Sun, 19 May 2024 09:51:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bYOEMXai" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 341236AA7; Sun, 19 May 2024 09:51:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716112267; cv=none; b=Y8d1ybY0LeYh+cMTl0UohvbyGQ7JOUWxFWlNPT9M6/krpfwq15iJsDehAyzKI2/MhWv+K/WMqV168mWzwva7sOIYChAjrfsoPl7CV1vePluMJqOugZXWlWuVyR4iya4d/SReK7+6cnbR0JvJ6SVrgnB/eInSnvhDnWSkmowZUyU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716112267; c=relaxed/simple; bh=3JprvdO4cAbJlWHvij0ANYG8YTOgEtlE3SRHny01vHc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Qww84NTwDUkHIwmMjoFx/Ln80KuT8zCo94oWswc/Zgl8YW6DCsoQSYcpD33IlSPgWUW0hO+uNG0MvUsyyoHGzdDq5CE1NU5+ICwa+YAoUJS06djAB2c6asPBZ3eBLYat6h3txPUD6r8agr+CQy8QE36fhoE3GfYWg+EjIJkCjGI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bYOEMXai; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDF99C32781; Sun, 19 May 2024 09:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716112266; bh=3JprvdO4cAbJlWHvij0ANYG8YTOgEtlE3SRHny01vHc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=bYOEMXaiDaXa4Z+VLFHYVC0Xjy8k5/iFXajnYrOO1abWEOO9wJBLpg6bW4CzuXzUe ZtufpgrWw9ZdmiY40OV8n5w4IQiv7xVYeGQnjKFg7szhkuP7KxsfGHqOvp+nIYzbgn 1joYT+SU8j6bv9b5UhLr4KnSiG1VQ2mWTk7tNqxfeXgvbDC8Atxdd5Uu2jqmBEINml HxalfXiZuZH3V899gM1ri/33zo8rwrhK164QzMNzDCbZ87EGsHp2Nv1HWQ63tcMXWJ /7Uskv4YBHqRlcgBEpqNgovZZ6ZpaOVi47nbHbxtZ0wDLMI5epVWHzBTHeNZuxh0De zakUSmETtXjCQ== Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-51ffff16400so5457787e87.2; Sun, 19 May 2024 02:51:06 -0700 (PDT) X-Gm-Message-State: AOJu0YwmynHkG0KIq6OudVpXd130KiAO0oKJcwS8J0Le0K+cFi+xND4v 1K9W/rEBQjLs4h8p7UTkPLSdJGkmoc//K4aOsProkloXThjNGT7MSwB7YyvNf18zuApMRU9ZMQN WsD7XfZqWzisXabUkbj/ZIH+jEKk= X-Received: by 2002:a05:6512:3d8c:b0:51e:f79e:15d9 with SMTP id 2adb3069b0e04-5220fd7ce7dmr27793820e87.21.1716112265456; Sun, 19 May 2024 02:51:05 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240519092227.2101109-1-masahiroy@kernel.org> In-Reply-To: <20240519092227.2101109-1-masahiroy@kernel.org> From: Masahiro Yamada Date: Sun, 19 May 2024 18:50:29 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kconfig: fix comparison to constant symbols, 'm', 'n' To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, May 19, 2024 at 6:22=E2=80=AFPM Masahiro Yamada wrote: > > Currently, comparisons to 'm' or 'n' result in incorrect output. > > [Test Code] > > config MODULES > def_bool y > modules > > config A > def_tristate m > > config B > def_bool A > n > > CONFIG_B is actually unset, while the expectation is CONFIG_B=3Dy. > > The reason for the issue is because Kconfig compares the tristate values > as strings. > > Currently, the .type fields of the constant symbols, 'y', 'm', and 'n' > are unspecified, i.e., S_UNKNOWN. > > When expr_calc_value() evaluates 'A > n', it checks the types of 'A' and > 'n' to determine how to compare them. > > The left-hand side, 'A', is a tristate symbol with a value of 'm', which > corresponds to a numeric value of 1. (Internally, 'y', 'm', and 'n' are > represented as 2, 1, and 0, respectively.) > > The right-hand side, 'n', has an unknown type, so it is treated as the > string "n" during the comparison. > > expr_calc_value() compares two values numerically only when both can > have numeric values. Otherwise, they are compared as strings. > > symbol numeric value ASCII code > ------------------------------------- > y 2 0x79 > m 1 0x6d > n 0 0x6e > > 'm' is greater than 'n' if compared numerically (since 1 is greater > than 0), but small than 'n' if compared as strings (since the ASCII small than -> smaller than --=20 Best Regards Masahiro Yamada