Topics

How to check if a Kconfig string is empty? #defines #builds


arnaud.durand@...
 

Given this Kconfig:
config MY_STR
    string "A string"


The directive #if defined(CONFIG_MY_STR) will eval to true for the default empty string.

How to check if CONFIG_MY_STR is an empty string at compile time? Is it a better practice to use a second boolean value (e.g. CONFIG_USE_MY_STR) like the following?
config MY_STR
    string "A string"
    depends on USE_MY_STR

config USE_MY_STR
    bool "Enable MY_STR"