kconfig: loosen the order of "visible" and "depends on" in menu entry
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 11 Dec 2018 11:00:56 +0000 (20:00 +0900)
committerChristian Lamparter <chunkeey@gmail.com>
Sun, 10 Feb 2019 21:32:06 +0000 (22:32 +0100)
Currently, "visible" and "depends on", if defined in a menu entry,
must appear in that order.

The real example is in drivers/media/tuners/Kconfig:

  menu "Customize TV tuners"
          visible if <expr1>
          depends on <expr2>

... is fine, but you cannot change the property order like this:

  menu "Customize TV tuners"
          depends on <expr2>
          visible if <expr1>

Kconfig does not require a specific order of properties. In this case,
menu_add_visibility(() and menu_add_dep() are orthogonal.

Loosen this unreasonable restriction.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
config/zconf.y

index f72e8994429cd8080042f0135466ef26fd4c23fd..95da8126d7047f28e77224da33f15b66a8bfcbfe 100644 (file)
@@ -341,7 +341,7 @@ menu: T_MENU prompt T_EOL
        printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
 };
 
        printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
 };
 
-menu_entry: menu visibility_list depends_list
+menu_entry: menu menu_option_list
 {
        $$ = menu_add_menu();
 };
 {
        $$ = menu_add_menu();
 };
@@ -357,6 +357,12 @@ menu_end: end
 menu_stmt: menu_entry stmt_list menu_end
 ;
 
 menu_stmt: menu_entry stmt_list menu_end
 ;
 
+menu_option_list:
+         /* empty */
+       | menu_option_list visible
+       | menu_option_list depends
+;
+
 source_stmt: T_SOURCE prompt T_EOL
 {
        printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2);
 source_stmt: T_SOURCE prompt T_EOL
 {
        printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2);
@@ -414,12 +420,6 @@ depends: T_DEPENDS T_ON expr T_EOL
 };
 
 /* visibility option */
 };
 
 /* visibility option */
-
-visibility_list:
-         /* empty */
-       | visibility_list visible
-;
-
 visible: T_VISIBLE if_expr T_EOL
 {
        menu_add_visibility($2);
 visible: T_VISIBLE if_expr T_EOL
 {
        menu_add_visibility($2);