config MODULES
    bool "MODULES"

#
# Symbol visibility
#

config NO_PROMPT
    bool

# Not rewritten, so MOD will have the value 'y' when running without modules
config MOD
    def_tristate m

config BOOL_n
    bool "bool n" if n

# Rewritten to m && MODULES
config BOOL_m
    bool "bool m" if m

# Not rewritten
config BOOL_MOD
    bool "bool MOD"
    depends on MOD

# Rewritten to m && MODULES
config BOOL_y
    bool "bool y"
    depends on y || m

config TRISTATE_n
    tristate "tristate n" if n

# Rewritten to m && MODULES
config TRISTATE_m
    tristate "tristate m" if m

# Not rewritten
config TRISTATE_MOD
    tristate "tristate MOD"
    depends on MOD

# Rewritten to m && MODULES
config TRISTATE_y
    bool "tristate y"
    depends on y || m

# Symbols nested in 'if'

if n
config BOOL_if_n
    bool "bool if n"
config TRISTATE_if_n
    tristate "tristate if n"
endif

if m
config BOOL_if_m
    bool "bool if m"
config TRISTATE_if_m
    tristate "tristate if n"
endif

if y
config BOOL_if_y
    bool "bool if y"
config TRISTATE_if_y
    tristate "tristate if y"
endif

# Symbols nested in 'menu'

menu "menu 1"
    depends on n
config BOOL_menu_n
    bool "bool menu n"
config TRISTATE_menu_n
    tristate "tristate menu n"
endmenu

menu "menu 2"
    depends on m
config BOOL_menu_m
    bool "bool menu m"
config TRISTATE_menu_m
    tristate "tristate menu n"
endmenu

menu "menu 3"
    depends on y
config BOOL_menu_y
    bool "bool menu y"
config TRISTATE_menu_y
    tristate "tristate menu y"
endmenu

# Symbols nested in choices

choice C1
    tristate "choice n" if n
config BOOL_choice_n
    bool "bool choice n"
config TRISTATE_choice_n
    tristate "tristate choice n"
endchoice

choice C2
    tristate "choice m" if m
config BOOL_choice_m
    bool "bool choice m"
config TRISTATE_choice_m
    tristate "tristate choice n"
endchoice

choice C3
    tristate "choice y" if y
config BOOL_choice_y
    bool "bool choice y"
config TRISTATE_choice_y
    tristate "tristate choice y"
endchoice

#
# Choice visibility
#

choice BOOL_CHOICE_n
    bool "bool choice n" if n
config A
    bool "A"
config B
    bool "B"
endchoice

choice BOOL_CHOICE_m
    bool "bool choice m" if m
config C
    bool "C"
config D
    bool "D"
endchoice

choice BOOL_CHOICE_y
    bool "bool choice y" if y
config E
    bool "E"
config F
    bool "F"
endchoice

choice TRISTATE_CHOICE_n
    tristate "tristate choice n" if n
config G
    tristate "G"
config H
    tristate "H"
endchoice

choice TRISTATE_CHOICE_m
    tristate "tristate choice m" if m
config I
    tristate "I"
config J
    tristate "J"
endchoice

choice TRISTATE_CHOICE_y
    tristate "tristate choice y" if y
config K
    tristate "K"
config L
    tristate "L"
endchoice

if m
choice TRISTATE_CHOICE_IF_m_and_y
    tristate "tristate choice if m and y" if y
config M
    bool "M"
config N
    bool "N"
endchoice
endif

menu "choice-containing menu"
    depends on n && y
choice TRISTATE_CHOICE_MENU_n_and_y
    tristate "tristate choice if n and y"
config O
    tristate "O"
config P
    tristate "P"
endchoice
endmenu

#
# Menu visibility
#

menu "menu n"
    depends on n
endmenu

menu "menu m"
    depends on m
endmenu

menu "menu y"
    depends on y
endmenu

if n
menu "menu if n"
endmenu
endif

if m
menu "menu if m"
endmenu
endif

if y
menu "menu if y"
endmenu
endif

if m
menu "menu if m and y"
    depends on y
endmenu
endif

#
# Comment visibility
#

comment "comment n"
    depends on n
comment "comment m"
    depends on m
comment "comment y"
    depends on y

if n
comment "comment if n"
endif
if m
comment "comment if m"
endif
if y
comment "comment if y"
endif

if "y"
menu "comment-containing menu"
    depends on m
comment "double-nested m comment"
    depends on y
endmenu
endif

# Used to verify that string/int/hex symbols with m visibility accept a user
# value

if m

config STRING_m
    string "string"

config INT_m
    int "int"

config HEX_m
    hex "hex"

endif

# Menu 'visible if' visibility

menu "n-visible menu"
    visible if n
config VISIBLE_IF_n
    tristate "visible if n"
endmenu

menu "m-visible menu"
    visible if m
config VISIBLE_IF_m
    tristate "visible if m"
endmenu

menu "y-visible menu"
    visible if y
config VISIBLE_IF_y
    tristate "visible if m"
endmenu

menu "m-visible menu 2"
    visible if y || n
    visible if m && y
    visible if y
if y
config VISIBLE_IF_m_2
    tristate "visible if m 2"
endif
endmenu
