[experiments] Fix bug in codegen for debug experiments (#33282)

Somehow this was missed earlier because none of the experiments were
enabled in debug builds.
pull/33288/head
Vignesh Babu 2 years ago committed by GitHub
parent 531a6be335
commit ad4d495570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      tools/codegen/core/experiments_compiler.py
  2. 2
      tools/codegen/core/gen_experiments.py

@ -326,7 +326,7 @@ class ExperimentsCompiler(object):
"const char* const additional_constraints_%s = %s;" % "const char* const additional_constraints_%s = %s;" %
(exp.name, ToCStr(json.dumps(exp.additional_constraints))), (exp.name, ToCStr(json.dumps(exp.additional_constraints))),
file=C) file=C)
have_defaults.add(exp.default) have_defaults.add(self._defaults[exp.default])
if 'kDefaultForDebugOnly' in have_defaults: if 'kDefaultForDebugOnly' in have_defaults:
print("#ifdef NDEBUG", file=C) print("#ifdef NDEBUG", file=C)
if 'kDefaultForDebugOnly' in have_defaults: if 'kDefaultForDebugOnly' in have_defaults:

@ -39,7 +39,7 @@ FINAL_RETURN = {
'broken': 'return false;', 'broken': 'return false;',
False: 'return false;', False: 'return false;',
True: 'return true;', True: 'return true;',
'debug': '#ifdef NDEBUG\nreturn false;\n#else\nreturn true;\n#endif', 'debug': '\n#ifdef NDEBUG\nreturn false;\n#else\nreturn true;\n#endif\n',
} }
FINAL_DEFINE = { FINAL_DEFINE = {

Loading…
Cancel
Save