diff options
author | Batuhan Taskaya <batuhanosmantaskaya@gmail.com> | 2020-05-24 22:20:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-24 22:20:18 (GMT) |
commit | cba503151056b448b7a3730dc36ef6655550ade5 (patch) | |
tree | 14ca6b160da3cb46ea02a2db2476b9a7cff291a0 /Tools | |
parent | c73914a562580ae72048876cb42ed8e76e2c83f9 (diff) | |
download | cpython-cba503151056b448b7a3730dc36ef6655550ade5.zip cpython-cba503151056b448b7a3730dc36ef6655550ade5.tar.gz cpython-cba503151056b448b7a3730dc36ef6655550ade5.tar.bz2 |
bpo-40334: Support suppressing of multiple optional variables in Pegen (GH-20367)
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/peg_generator/pegen/c_generator.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Tools/peg_generator/pegen/c_generator.py b/Tools/peg_generator/pegen/c_generator.py index 362698b..1249d4f 100644 --- a/Tools/peg_generator/pegen/c_generator.py +++ b/Tools/peg_generator/pegen/c_generator.py @@ -694,8 +694,8 @@ class CParserGenerator(ParserGenerator, GrammarVisitor): if v == "_cut_var": v += " = 0" # cut_var must be initialized self.print(f"{var_type}{v};") - if v == "_opt_var": - self.print("UNUSED(_opt_var); // Silence compiler warnings") + if v.startswith("_opt_var"): + self.print(f"UNUSED({v}); // Silence compiler warnings") with self.local_variable_context(): if is_loop: |