From 81b5c9cb65b14a85d2cccef1c471e10ce6ac8f21 Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Mon, 28 Mar 2016 15:49:07 +0100 Subject: [PATCH] Use 'size_t' instead of 'uint32_t' to avoid 'static_cast'. --- re2c/src/codegen/emit_action.cc | 25 +++++++++++-------------- re2c/src/ir/adfa/action.h | 4 ++-- re2c/src/ir/adfa/prepare.cc | 2 +- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/re2c/src/codegen/emit_action.cc b/re2c/src/codegen/emit_action.cc index d5abef44..0b9743ed 100644 --- a/re2c/src/codegen/emit_action.cc +++ b/re2c/src/codegen/emit_action.cc @@ -23,7 +23,7 @@ class label_t; static void need (OutputFile & o, uint32_t ind, bool & readCh, size_t n, bool bSetMarker); static void emit_match (OutputFile & o, uint32_t ind, bool & readCh, const State * const s); static void emit_initial (OutputFile & o, uint32_t ind, bool & readCh, const State * const s, const Initial & init, const std::set & used_labels); -static void emit_save (OutputFile & o, uint32_t ind, bool & readCh, const State * const s, uint32_t save, bool save_yyaccept); +static void emit_save (OutputFile & o, uint32_t ind, bool & readCh, const State * const s, size_t save, bool save_yyaccept); static void emit_accept_binary (OutputFile & o, uint32_t ind, bool & readCh, const State * const s, const accept_t & accept, size_t l, size_t r); static void emit_accept (OutputFile & o, uint32_t ind, bool & readCh, const State * const s, const accept_t & accept); static void emit_rule(OutputFile &o, uint32_t ind, const State *const s, @@ -150,26 +150,23 @@ void emit_initial (OutputFile & o, uint32_t ind, bool & readCh, const State * co } } -void emit_save (OutputFile & o, uint32_t ind, bool & readCh, const State * const s, uint32_t save, bool save_yyaccept) +void emit_save(OutputFile &o, uint32_t ind, bool &readCh, + const State *const s, size_t save, bool save_yyaccept) { - if (opts->target == opt_t::DOT) - { + if (opts->target == opt_t::DOT) { return; } - if (save_yyaccept) - { - o.wind(ind).wstring(opts->yyaccept).ws(" = ").wu32(save).ws(";\n"); + if (save_yyaccept) { + o.wind(ind).wstring(opts->yyaccept).ws(" = ") + .wu64(save).ws(";\n"); } - if (s->fill != 0) - { - o.wstring(opts->input_api.stmt_skip_backup (ind)); + if (s->fill != 0) { + o.wstring(opts->input_api.stmt_skip_backup(ind)); need(o, ind, readCh, s->fill, false); - } - else - { - o.wstring(opts->input_api.stmt_skip_backup_peek (ind)); + } else { + o.wstring(opts->input_api.stmt_skip_backup_peek(ind)); readCh = false; } } diff --git a/re2c/src/ir/adfa/action.h b/re2c/src/ir/adfa/action.h index d5822d2e..cc0b6c87 100644 --- a/re2c/src/ir/adfa/action.h +++ b/re2c/src/ir/adfa/action.h @@ -41,7 +41,7 @@ public: union { Initial * initial; - uint32_t save; + size_t save; const accept_t * accepts; size_t rule; } info; @@ -61,7 +61,7 @@ public: type = INITIAL; info.initial = new Initial (label, used_marker); } - void set_save (uint32_t save) + void set_save (size_t save) { clear (); type = SAVE; diff --git a/re2c/src/ir/adfa/prepare.cc b/re2c/src/ir/adfa/prepare.cc index 596d8138..9e69f69f 100644 --- a/re2c/src/ir/adfa/prepare.cc +++ b/re2c/src/ir/adfa/prepare.cc @@ -180,7 +180,7 @@ void DFA::prepare () for (State *s = head; s; s = s->next) { if (s->fallback) { const size_t accept = accepts.find_or_add(rule2state[s->rule]); - s->action.set_save(static_cast(accept)); + s->action.set_save(accept); } } default_state->action.set_accept(&accepts); -- 2.40.0