Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp314018lqa; Sat, 27 Apr 2024 03:43:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWBvjkWh+hI9Tb7lUtG4urnMzVYtDLhw2rtfckfgh1XYRhSj1ZT8kY7F+Nbz76EdR7Qk1dBwZjkcnCmrbfIFMclhlbYAd+R9Jb34pov9w== X-Google-Smtp-Source: AGHT+IHcD1DfdCNFp9I9FCVaDbevbz1P4W+ZF7qxC2/mPIJuLR7K43DXJ1Nra8zLdFaqpkS7cVBV X-Received: by 2002:aca:912:0:b0:3c8:2c9c:6e8c with SMTP id 18-20020aca0912000000b003c82c9c6e8cmr5334737oij.48.1714214598286; Sat, 27 Apr 2024 03:43:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714214598; cv=pass; d=google.com; s=arc-20160816; b=x4fCy2/lKPm/WX1Sq29Tw3oHXJ4fm4xgksFvVILO28sn+V5LAr+5NqQ4s3Nzj9YLc7 88MguGVZiIMgtIjtqn201L9g/DId+KHPkt5adR2C9KD64+i40hANyovn0/m5iBsW7aXl bQJ2FRSfsBuabJOM+tTOxoHZKmqJLETGUB5gqjW1+z54h733HY92sRVtRC0RHTV0jtkb ii5seG+PWJZOqFhXBxTOeptnX06kSO7ZDpcm5u2rNRlB37ps8DYH8EPXiT7Q5dmHY1HC D4l61qkBXKEGUQFRQtZw2mhkWCv9FyknsjTcwghWmIyaWkuTaA9DUksXYI2tukOvUTZt g7IQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=MgmNDfC7IKkZE3BvuUGhUiBz7xnU0SeUUAYZWj0A94I=; fh=6RsT17M2o1ESZANZ4LW6YJ3OhjNldKJN06gzW6ZBCMk=; b=HESaOIeXAduADeJm+AvBeh9vlcD9R/UaVFd81KQ3KwqfpC72H1Y2zmdKK6rtCUUCKZ 9q96vVj+y8GZERz7N1A+dJpxTAk6WOUGfc1vdLANHJcaRzP2o5iszjvEfil+Lz+UHeMD sVeZdWXKXDLUMDipiBItSnw1mNPkeycDksXr0eDMnvorjTfriKQOWIAhbGq12VXNegb9 5U8BEEQw4kzJrBtAmNfsY8TMIIexV918RLEPwCUq++xbme+wRMqpxPGFaU4uJkYweJ1t q4AudKcWA/Gm+Q4Kc6xiYrVRnAYHMky666tp4Pbf5169cJHtATtXpuvzZGy/CNXpP20s lJwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BsnFewS0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-160996-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160996-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p8-20020a637408000000b005fcada7ca61si12149547pgc.8.2024.04.27.03.43.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 03:43:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160996-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BsnFewS0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-160996-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160996-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id DDCB4282491 for ; Sat, 27 Apr 2024 10:43:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 597E445009; Sat, 27 Apr 2024 10:43:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BsnFewS0" 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 6E33C383B2; Sat, 27 Apr 2024 10:43:09 +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=1714214589; cv=none; b=TrNJoiHK1TCd6gFMzPCJu34ydoopCAtViH0DidJ/xtijVXiHTsTbZ468LE4AC15fKn6Ki/GufbkqatqLrUe+tOwdTxh2ORfCmC5ecnP/sGaCKiSgT0b1ztb66ol4y1/gJW2xeEhLqD5lhb+iCwZ7Mlc69yzpPBN6EkPMa/UG8zo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714214589; c=relaxed/simple; bh=yXENlZl/r+zrHsbm7JYiplM9HzFo663usaZ7tCpedTQ=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=YfAdWmndWAKKqYNyYOQP8kX5p/RrJ/TmvizHlvHeZUSeWvf+zVoKpOErcUH5HONk6pQ7++yFSZqNd+QjXaw5peL8YacbybdoHo/IENp7lpb7fgmnvN0FIq2rS1G/KJ8RZyTekb+eKhkZkwnREqfn4PBbrC5AJcVzcc6wGEGYETg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BsnFewS0; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16541C113CE; Sat, 27 Apr 2024 10:43:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714214589; bh=yXENlZl/r+zrHsbm7JYiplM9HzFo663usaZ7tCpedTQ=; h=From:To:Cc:Subject:Date:From; b=BsnFewS02DuNgUww69Y9ZuSeu1vk2yOL/Da4Wm63rWglc8X8AMGT3t7iPxLFhAUG4 wumsrDz6RJAwZ6MBHaR3U2jEe72YQCYDsaNgaty6YlXWLlpM1p9PQ4vW6dk6URmfrc l79K1EeFHIEAXbBvlndW5Zon55Tc46204ZGucIeUEg8zYudIMcys2K7+3yTc0Pv/vj F+T1JumyQ/uRCp5bvltzmD8kZR9up0829haS6a06/NJWUylAvneNB6CdJ2+L6A85Jv sOVYU8axQmZhp2JnxazoFoTi9AMMnz6APSrDr270KEBq6WLP4nnBcH6MWlnqHtOkPY YM758Ph5B2dlQ== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Matt Porter , Alexandre Bounine , Masahiro Yamada , Jonathan Corbet , Nathan Chancellor , Nicolas Schier , linux-doc@vger.kernel.org Subject: [PATCH 0/2] kconfig: stop implification of choice type Date: Sat, 27 Apr 2024 19:42:29 +0900 Message-Id: <20240427104231.2728905-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit There are two types supported for the choice statement, "bool" and "tristate". There is no ambiguity if you explicitly specifiy the type of the choice. For example choice bool "choose" ... endchoice Or, choice tristate "choose" ... endchoice Those are valid code, and clear about the behavior. However, if you see the reality in the kernel code, most of people omit the type definition. Usually, the choice is written like this: choice prompt "choose" ... endchoice The "prompt" does not specify the type at all. You may wonder how Kconfig knows the choice type then. When the choice type is not specified, Kconfig infers it from the first entry within the choice block. In the following, the choice type is bool because the first entry, CONFIG_A, is bool. choice prompt "choose" config A bool "A" config B bool "B" endchoice As described in 2/2, this has a bug when "if" ... "endif" exists within a "choice" ... "endchoice". Of course, I can fix this bug, but the value of this feature is questionable. This patch set stop the type implification. Instead, make the default type of the choice "bool". This is reasonable because 99% of choice blocks are bool. The only user of tristate choice is drivers/rapidio/Kconfig. (although that choice is unneeded because it cotains a single entry, RAPIDIO_ENUM_BASIC) It changed it to specify "tristate" explicitly. Masahiro Yamada (2): rapidio: specify the type for tristate choice explicitly kconfig: do not imply the type of choice from the first entry Documentation/kbuild/kconfig-language.rst | 4 +--- drivers/rapidio/Kconfig | 2 +- scripts/kconfig/menu.c | 11 ----------- scripts/kconfig/parser.y | 3 +++ scripts/kconfig/tests/choice/Kconfig | 2 +- scripts/kconfig/tests/choice_value_with_m_dep/Kconfig | 2 +- 6 files changed, 7 insertions(+), 17 deletions(-) -- 2.40.1