summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-05-24 22:38:47 (GMT)
committerGitHub <noreply@github.com>2020-05-24 22:38:47 (GMT)
commit82c274e3ba7d011e93805f1552e90baea1752cf1 (patch)
tree18f748daefeb04976d3bef01e87f6940dac831fc
parent1a4e9e6f35dad26b37639198f1444591d04399e0 (diff)
downloadcpython-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>
-rw-r--r--Tools/peg_generator/pegen/c_generator.py4
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: