Skip to content

Commit

Permalink
Merge pull request katef#475 from katef/sv/vmc-codegen-opaque-param-a…
Browse files Browse the repository at this point in the history
…nd-warning

Add `void* opaque` to vmc codegen too, disable unused warning.
  • Loading branch information
katef authored May 31, 2024
2 parents 65d8624 + a3fb7d7 commit e6ba81b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/libfsm/print/c.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ fsm_print_c_complete(FILE *f, const struct ir *ir,
case FSM_IO_GETC:
fprintf(f, "(int (*fsm_getc)(void *opaque), void *opaque)\n");
fprintf(f, "{\n");
fprintf(f, "\t(void)opaque;\n");
if (ir->n > 0) {
fprintf(f, "\tint c;\n");
fprintf(f, "\n");
Expand All @@ -436,6 +437,7 @@ fsm_print_c_complete(FILE *f, const struct ir *ir,
case FSM_IO_STR:
fprintf(f, "(const char *s, void *opaque)\n");
fprintf(f, "{\n");
fprintf(f, "\t(void)opaque;\n");
if (ir->n > 0) {
fprintf(f, "\tconst char *p;\n");
fprintf(f, "\n");
Expand All @@ -445,6 +447,7 @@ fsm_print_c_complete(FILE *f, const struct ir *ir,
case FSM_IO_PAIR:
fprintf(f, "(const char *b, const char *e, void *opaque)\n");
fprintf(f, "{\n");
fprintf(f, "\t(void)opaque;\n");
if (ir->n > 0) {
fprintf(f, "\tconst char *p;\n");
fprintf(f, "\n");
Expand Down
6 changes: 4 additions & 2 deletions src/libfsm/print/vmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,13 +472,15 @@ fsm_print_c_complete(FILE *f, const struct ir *ir, const struct fsm_options *opt
break;

case FSM_IO_STR:
fprintf(f, "(const char *s)\n");
fprintf(f, "(const char *s, void *opaque)\n");
fprintf(f, "{\n");
fprintf(f, "\t(void)opaque;\n");
break;

case FSM_IO_PAIR:
fprintf(f, "(const char *b, const char *e)\n");
fprintf(f, "(const char *b, const char *e, void *opaque)\n");
fprintf(f, "{\n");
fprintf(f, "\t(void)opaque;\n");
break;
}

Expand Down

0 comments on commit e6ba81b

Please sign in to comment.