Skip to content

Commit 594cf95

Browse files
authored
Cpp: Fix the unused parameter warning in the sempred function. (#4171)
Signed-off-by: FireWolf <[email protected]>
1 parent 811b7fd commit 594cf95

File tree

1 file changed

+2
-2
lines changed
  • tool/resources/org/antlr/v4/tool/templates/codegen/Cpp

1 file changed

+2
-2
lines changed

tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,13 @@ void <r.factory.grammar.name>::<r.name>Action(<r.ctxType> *context, size_t actio
272272
>>
273273

274274
RuleSempredFunctionHeader(r, actions) ::= <<
275-
bool <r.name>Sempred(<r.ctxType> *_localctx, size_t predicateIndex);
275+
bool <r.name>Sempred([[maybe_unused]] <r.ctxType> *_localctx, size_t predicateIndex);
276276
>>
277277

278278
RuleSempredFunction(r, actions) ::= <<
279279
<! Called for both lexer and parser. But only one of them is actually available. Testing for the parser directly
280280
generates a warning, however. So do the check via the factory instead. !>
281-
bool <if (r.factory.g.lexer)><lexer.name><else><parser.name><endif>::<r.name>Sempred(<r.ctxType> *_localctx, size_t predicateIndex) {
281+
bool <if (r.factory.g.lexer)><lexer.name><else><parser.name><endif>::<r.name>Sempred([[maybe_unused]] <r.ctxType> *_localctx, size_t predicateIndex) {
282282
switch (predicateIndex) {
283283
<actions: {index | case <index>: return <actions.(index)>}; separator=";\n">;
284284

0 commit comments

Comments
 (0)