diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-05-24 22:38:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-24 22:38:47 (GMT) |
commit | 82c274e3ba7d011e93805f1552e90baea1752cf1 (patch) | |
tree | 18f748daefeb04976d3bef01e87f6940dac831fc /Tools | |
parent | 1a4e9e6f35dad26b37639198f1444591d04399e0 (diff) | |
download | cpython-82c274e3ba7d011e93805f1552e90baea1752cf1.zip cpython-82c274e3ba7d011e93805f1552e90baea1752cf1.tar.gz cpython-82c274e3ba7d011e93805f1552e90baea1752cf1.tar.bz2 |
bpo-40334: Support suppressing of multiple optional variables in Pegen (GH-20367)
(cherry picked from commit cba503151056b448b7a3730dc36ef6655550ade5)
Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
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: |