summaryrefslogtreecommitdiff
path: root/scripts/kconfig/expr.c
AgeCommit message (Collapse)Author
2015-10-20kconfig: Fix copy&paste errorMichal Sojka
Fixes: 31847b67bec0 ("kconfig: allow use of relations other than (in)equality") Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz> Reviewed-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-06-15kconfig: allow use of relations other than (in)equalityJan Beulich
Over the years I found it desirable to be able to use all sorts of relations, not just (in)equality. And apparently I'm not the only one, as there's at least one example in the tree where the programmer assumed this would work (see DEBUG_UART_8250_WORD in arch/arm/Kconfig.debug). Another possible use would e.g. be to fold the two SMP/NR_CPUS prompts into one: SMP could be promptless, simply depending on NR_CPUS > 1. A (desirable) side effect of this change - resulting from numeric values now necessarily being compared as numbers rather than as strings - is that comparing hex values now works as expected: Other than int ones (which aren't allowed to have leading zeroes), zeroes following the 0x prefix made them compare unequal even if their values were equal. Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-05-25Kconfig: Remove bad inference rules expr_eliminate_dups2()Martin Walch
expr_eliminate_dups2() in scripts/kconfig/expr.c applies two invalid inference rules: (FOO || BAR) && (!FOO && !BAR) -> n (FOO && BAR) || (!FOO || !BAR) -> y They would be correct in propositional logic, but this is a three-valued logic, and here it is wrong in that it changes semantics. It becomes immediately visible when assigning the value 1 to both, FOO and BAR: (FOO || BAR) && (!FOO && !BAR) -> min(max(1, 1), min(2-1, 2-1)) = min(1, 1) = 1 while n evaluates to 0 and (FOO && BAR) || (!FOO || !BAR) -> max(min(1, 1), max(2-1, 2-1)) = max(1, 1) = 1 with y evaluating to 2. Fix it by removing expr_eliminate_dups2() and the functions that have no use anywhere else: expr_extract_eq_and(), expr_extract_eq_or(), and expr_extract_eq() from scripts/kconfig/expr.c Currently the bug is not triggered in mainline, so this patch does not modify the configuration space there. To observe the bug consider this example: config MODULES def_bool y option modules config FOO def_tristate m config BAR def_tristate m config TEST1 def_tristate y depends on (FOO || BAR) && (!FOO && !BAR) if TEST1 = n comment "TEST1 broken" endif config TEST2 def_tristate y depends on (FOO && BAR) || (!FOO || !BAR) if TEST2 = y comment "TEST2 broken" endif config TEST3 def_tristate y depends on m && !m if TEST3 = n comment "TEST3 broken" endif TEST1, TEST2 and TEST3 should all evaluate to m, but without the patch, none of them does. It is probably not obvious that TEST3 is the same bug, but it becomes clear when considering what happens internally to the expression m && !m": First it expands to (m && MODULES) && !(m && MODULES), then it is transformed into (m && MODULES) && (!m || !MODULES), and finally due to the bug it is replaced with n. As a side effect, this patch reduces code size in expr.c by roughly 10% and slightly improves startup time for all configuration frontends. Signed-off-by: Martin Walch <walch.martin@web.de> Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-02-25kconfig: Remove unnecessary prototypes from headersMichal Marek
Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-02-25kconfig: Remove dead codeMichal Marek
Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-11-20kconfig: Fix malloc handling in conf toolsAlan Cox
(and get them out of the noise in the audit work) Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2011-07-02kconfig: use calloc() for expr allocationArnaud Lacombe
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
2011-06-06kconfig: nuke LKC_DIRECT_LINK cruftArnaud Lacombe
This interface is not (and has never been ?) used by any frontend, just get rid of it. Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
2010-12-21kconfig: Make expr_copy() take a const argumentMichal Marek
Fixes scripts/kconfig/expr.c: In function ‘expr_get_leftmost_symbol’: scripts/kconfig/expr.c:1026:2: warning: passing argument 1 of ‘expr_copy’ discards qualifiers from pointer target type scripts/kconfig/expr.c:67:14: note: expected ‘struct expr *’ but argument is of type ‘const struct expr *’ Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-12-21kconfig: simplify select-with-unmet-direct-dependency warningArnaud Lacombe
This is an attempt to simplify the expressing printed by kconfig when a symbol is selected but still has direct unmet dependency. First, the symbol reverse dependency is split in sub-expression. Then, each sub-expression is checked to ensure that it does not contains the unmet dependency. This removes the false-positive symbols and fixed symbol which already have the correct dependency. Finally, only the symbol responsible of the "select" is printed, instead of its full dependency tree. CC: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Arnaud Lacombe <lacombar@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-08-12kconfig: Fix warning: ignoring return value of 'fwrite'Jean Sacren
This fix facilitates fwrite() in both confdata.c and expr.c, either it succeeds in writing, or an error occurs, or the end of file is reached. Signed-off-by: Jean Sacren <sakiwit@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-02kconfig: print the range of integer/hex symbol in help textLi Zefan
Without this patch, one has to refer to the Kconfig file to find out the range of an integer/hex symbol. │ Symbol: NR_CPUS [=4] │ Type : integer │ Range : [2 8] │ Prompt: Maximum number of CPUs │ Defined at arch/x86/Kconfig:761 │ Depends on: SMP [=y] && !MAXSMP [=n] │ Location: │ -> Processor type and features Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02menuconfig: wrap long help linesVadim Bendebury (вб)
Help text for certain config options is very extensive (the text includes the names of all other options the option in question depends on). Long lines are not wrapped, making it impossible to see the list without scrolling horizontally. This patch adds some logic which wraps help screen lines at word boundaries to prevent truncating. Tested by running ARCH=powerpc make menuconfig O=/tmp/build which shows that the long lines are now wrapped, and ARCH=powerpc make xconfig O=/tmp/build to demonstrate that it still compiles and operates as expected. Signed-off-by: Vadim Bendebury <vbendeb@google.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2009-09-20kbuild: add static to prototypesTrevor Keith
Warnings found via gcc -Wmissing-prototypes. Signed-off-by: Trevor Keith <tsrk@tsrk.net> Acked-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-09-20kconfig: add symbol value to help find the real dependCheng Renquan
Sometimes when configuring need to disable some unused item, but the item is selected by many other items, it's hard to find the real dependency which selected it, This patch add every symbol's value accompanied to make it possible to find the real dependency easily. An example is CONFIG_RFKILL, ---------------------- RF switch subsystem support ---------------------- | CONFIG_RFKILL: | | | | Say Y here if you want to have control over RF switches | | found on many WiFi and Bluetooth cards. | | | | To compile this driver as a module, choose M here: the | | module will be called rfkill. | | | | Symbol: RFKILL [=m] | | Prompt: RF switch subsystem support | | Defined at net/rfkill/Kconfig:4 | | Depends on: NET [=y] | | Location: | | -> Networking support (NET [=y]) | | Selected by: IWLCORE [=n] && NETDEVICES [=y] && !S390 [=S390] && PC | | | ----------------------------------------------------------------( 99%)--- Signed-off-by: Cheng Renquan <crquan@gmail.com> Cc: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28kconfig: tristate choices with mixed tristate and boolean valuesJan Beulich
Change kconfig behavior so that mixing bool and tristate config settings in a choice is possible and has the desired effect of offering just the tristate options individually if the choice gets set to M, and a normal boolean selection if the choice gets set to Y. Also fix scripts/kconfig/conf's handling of children of choice values - there may be more than one immediate child, and all of them need to be processed. Signed-off-by: Jan Beulich <jbeulich@novell.com> Cc: "Roman Zippel" <zippel@linux-m68k.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28kconfig: explicitly introduce expression listRoman Zippel
Rename E_CHOICE to E_LIST to explicitly add support for expression lists. Add a helper macro expr_list_for_each_sym to more easily iterate over the list. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28kconfig: rename E_OR & friends to avoid name clashSam Ravnborg
We had macros named the same as a set of enumeration values. It is legal code but very confusing to read - so rename the macros from E_* to EXPR_* Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Roman Zippel <zippel@linux-m68k.org>
2006-06-09kconfig: create links in info windowRoman Zippel
Extend the expression print helper function to allow customization of the symbol output and use it to add links to the info window. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-06-09kconfig: remove SYMBOL_{YES,MOD,NO}Roman Zippel
The SYMBOL_{YES,MOD,NO} are not really used anymore (they were more used be the cml1 converter), so just remove them. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2005-04-16Linux-2.6.12-rc2Linus Torvalds
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!