From 806eb493cacb552ec1148bdca48becd42a048845 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 23 Jun 2016 09:50:57 -0700 Subject: [PATCH] genconfig: undef bool options so #ifdef works Instead of always defining config values, only #define options that are enabled, so that #ifdef/#ifndef can be used. Generate #undef lines for the disabled variables so the names are still visible in config.h. Change-Id: Iaf56597ea6ae57b384387cc8a292d63960b611e4 Signed-off-by: Daniel Verkamp --- scripts/genconfig.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/genconfig.py b/scripts/genconfig.py index 64f1ce52d..d9513ddc0 100755 --- a/scripts/genconfig.py +++ b/scripts/genconfig.py @@ -24,10 +24,9 @@ with open('CONFIG') as f: val = argval if default.lower() == 'y' or default.lower() == 'n': if val.lower() == 'y': - boolval = 1 + print "#define SPDK_{} 1".format(var) else: - boolval = 0 - print "#define SPDK_{} {}".format(var, boolval) + print "#undef SPDK_{}".format(var) else: strval = val.replace('"', '\"') print "#define SPDK_{} \"{}\"".format(var, strval)