diff options
author | Raul E Rangel <rrangel@chromium.org> | 2019-04-04 14:58:16 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-20 03:56:08 +0000 |
commit | 6d0f31f1dbc631d586ab25368b52cd84a02b3b4b (patch) | |
tree | 2de2823fd3e2ba46d18a6f8fa9b8af0948c64894 /util/ectool_keyscan.c | |
parent | 65ce016544a8b6c015cd538d2ab388f34dd09989 (diff) | |
download | chrome-ec-6d0f31f1dbc631d586ab25368b52cd84a02b3b4b.tar.gz |
ec/common: Introduce IS_ENABLED to check config options
This is copied from coreboot with added support for empty defines. We
should favor using this macro instead of using #ifdef. The macro will
evaluate to 0 if the option is not defined. This allows all the code to
be compiled and then the optimizer will remove the sections of code that
won't ever run. This way we don't end up with #ifdef sections with
invalid syntax because no one ever tests that specific permutation.
e.g.,
if (IS_ENABLED(CONFIG_USBC_SS_MUX)) {
...
}
There are currently spots where #ifdefs are nested 3 levels deep. This
makes it very hard to follow the code.
BUG=none
TEST=Added some code that uses the macro and verified it executes when
the config value is defined, and doesn't when it's not.
Change-Id: I796b899f7cbbd3067ea3a4d52527d980c68935c9
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1553573
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3105733
Reviewed-by: caveh jalali <caveh@chromium.org>
Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'util/ectool_keyscan.c')
0 files changed, 0 insertions, 0 deletions