From: Ulya Trofimovich Date: Sat, 13 Jul 2019 10:03:13 +0000 (+0100) Subject: Fixed Clang warning -Wshadow. X-Git-Tag: 1.2~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5bb8aa5281e8efe4b3a5fd9c5725100aa50f6a1e;p=re2c Fixed Clang warning -Wshadow. --- diff --git a/bootstrap/src/parse/lex.cc b/bootstrap/src/parse/lex.cc index f65433a3..e28d2200 100644 --- a/bootstrap/src/parse/lex.cc +++ b/bootstrap/src/parse/lex.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 1.1.1 on Sat Jul 13 10:46:39 2019 */ +/* Generated by re2c 1.1.1 on Sat Jul 13 11:00:45 2019 */ #line 1 "../src/parse/lex.re" #include #include "src/util/c99_stdint.h" @@ -50,7 +50,7 @@ Scanner::ParseMode Scanner::echo(Output &out) next: tok = cur; loop: - loc = cur_loc(); + location = cur_loc(); ptr = cur; #line 57 "src/parse/lex.cc" @@ -1172,7 +1172,7 @@ int Scanner::scan() const char *p; scan: tok = cur; - loc = cur_loc(); + location = cur_loc(); #line 1178 "src/parse/lex.cc" { diff --git a/bootstrap/src/parse/lex.h b/bootstrap/src/parse/lex.h index 8ba656b3..e2aa68e7 100644 --- a/bootstrap/src/parse/lex.h +++ b/bootstrap/src/parse/lex.h @@ -1,4 +1,4 @@ -/* Generated by re2c 1.1.1 on Sat Jul 13 10:46:39 2019 */ +/* Generated by re2c 1.1.1 on Sat Jul 13 11:00:45 2019 */ #ifndef _RE2C_PARSE_LEX_ #define _RE2C_PARSE_LEX_ diff --git a/src/codegen/go.h b/src/codegen/go.h index 82c98e83..a819c6e5 100644 --- a/src/codegen/go.h +++ b/src/codegen/go.h @@ -180,9 +180,8 @@ struct Cpgoto struct Dot { - const State * from; Cases * cases; - Dot(const Span *sp, uint32_t nsp, const State *s, uint32_t eof); + Dot(const Span *sp, uint32_t nsp, uint32_t eof); ~Dot (); void emit (Output & o, const DFA &dfa, const State *from) const; diff --git a/src/codegen/go_construct.cc b/src/codegen/go_construct.cc index 559a4638..6f3a9c42 100644 --- a/src/codegen/go_construct.cc +++ b/src/codegen/go_construct.cc @@ -216,9 +216,8 @@ Cpgoto::Cpgoto (const Span * span, uint32_t nSpans, const Span * hspan , table (new CpgotoTable (span, nSpans)) {} -Dot::Dot (const Span * sp, uint32_t nsp, const State * s, uint32_t eof) - : from (s) - , cases (new Cases (sp, nsp, false, eof)) +Dot::Dot (const Span * sp, uint32_t nsp, uint32_t eof) + : cases (new Cases (sp, nsp, false, eof)) {} Go::Go () @@ -280,7 +279,7 @@ void Go::init(const State *from, const opt_t *opts, bitmaps_t &bitmaps) const bool part_skip = opts->eager_skip && !skip; if (opts->target == TARGET_DOT) { type = DOT; - info.dot = new Dot (span, nSpans, from, eof); + info.dot = new Dot (span, nSpans, eof); } else if (opts->gFlag && !part_skip && (dSpans >= opts->cGotoThreshold) && !low_spans_have_tags) { type = CPGOTO; diff --git a/src/codegen/output.cc b/src/codegen/output.cc index bbd97647..0d469a95 100644 --- a/src/codegen/output.cc +++ b/src/codegen/output.cc @@ -84,7 +84,7 @@ OutputBlock::~OutputBlock () Output::Output(Msg &msg) : cblocks() , hblocks() - , blocks(&cblocks) + , pblocks(&cblocks) , label_counter() , fill_index(0) , state_goto(false) @@ -105,12 +105,12 @@ Output::~Output () void Output::header_mode(bool on) { - blocks = on ? &hblocks : &cblocks; + pblocks = on ? &hblocks : &cblocks; } OutputBlock& Output::block() { - return *blocks->back(); + return *pblocks->back(); } std::ostream & Output::stream () @@ -247,7 +247,7 @@ Output &Output::wdelay_tags(const ConfTags *cf, bool mtags) OutputFragment *frag = new OutputFragment( mtags ? OutputFragment::MTAGS : OutputFragment::STAGS, 0); frag->tags = cf; - blocks->back()->fragments.push_back(frag); + pblocks->back()->fragments.push_back(frag); } return *this; } @@ -256,7 +256,7 @@ Output & Output::wdelay_line_info_input (const loc_t &loc) { OutputFragment *frag = new OutputFragment(OutputFragment::LINE_INFO_INPUT, 0); frag->loc = new loc_t(loc); - blocks->back()->fragments.push_back(frag); + pblocks->back()->fragments.push_back(frag); return *this; } @@ -356,7 +356,7 @@ void Output::new_block(Opt &opts, const loc_t &loc) { OutputBlock *b = new OutputBlock(loc); b->opts = opts.snapshot(); - blocks->push_back(b); + pblocks->push_back(b); // start label hapens to be the only option // that must be reset for each new block diff --git a/src/codegen/output.h b/src/codegen/output.h index b3c24ee2..726dd88c 100644 --- a/src/codegen/output.h +++ b/src/codegen/output.h @@ -103,7 +103,7 @@ class Output { blocks_t cblocks; /* .c file */ blocks_t hblocks; /* .h file */ - blocks_t *blocks; /* selector */ + blocks_t *pblocks; /* selector */ public: counter_t label_counter; diff --git a/src/debug/dump_dfa.cc b/src/debug/dump_dfa.cc index a36ef00c..ecef2ae7 100644 --- a/src/debug/dump_dfa.cc +++ b/src/debug/dump_dfa.cc @@ -105,9 +105,9 @@ void dump_dfa_t::state(const ctx_t &ctx, bool isnew) if (origin == dfa_t::NIL) { fprintf(stderr, " void [shape=point]\n"); - uint32_t i = 0; - for (c = b; c != e; ++c, ++i) { - fprintf(stderr, " void -> 0:%u:w [style=dotted label=\"", i); + uint32_t j = 0; + for (c = b; c != e; ++c, ++j) { + fprintf(stderr, " void -> 0:%u:w [style=dotted label=\"", j); dump_tags(tvtbl, thist, c->ttran, c->tvers); fprintf(stderr, "\"]\n"); } @@ -125,11 +125,11 @@ void dump_dfa_t::state(const ctx_t &ctx, bool isnew) fprintf(stderr, "\"]\n"); } - uint32_t i = 0; - for (c = b; c != e; ++c, ++i) { + uint32_t j = 0; + for (c = b; c != e; ++c, ++j) { fprintf(stderr, " %u:%u:e -> %s%u:%u:w [label=\"%u", - origin, c->origin, prefix, state, i, symbol); + origin, c->origin, prefix, state, j, symbol); dump_tags(tvtbl, thist, c->ttran, c->tvers); fprintf(stderr, "\"]\n"); } @@ -146,9 +146,9 @@ void dump_dfa_t::state(const ctx_t &ctx, bool isnew) DASSERT(c != e); fprintf(stderr, " r%u [shape=none label=\"(", state); - for (size_t t = r.ltag; t < r.htag; ++t) { - if (t > r.ltag) fprintf(stderr, " "); - fprintf(stderr, "%s%d", tagname(dfa.tags[t]), abs(dfa.finvers[t])); + for (size_t j = r.ltag; j < r.htag; ++j) { + if (j > r.ltag) fprintf(stderr, " "); + fprintf(stderr, "%s%d", tagname(dfa.tags[j]), abs(dfa.finvers[j])); } fprintf(stderr, ")\"]\n"); diff --git a/src/parse/lex.re b/src/parse/lex.re index 2b66c716..2ce3b554 100644 --- a/src/parse/lex.re +++ b/src/parse/lex.re @@ -127,7 +127,7 @@ Scanner::ParseMode Scanner::echo(Output &out) next: tok = cur; loop: - loc = cur_loc(); + location = cur_loc(); ptr = cur; /*!re2c "%{" | "/*!re2c" { @@ -296,7 +296,7 @@ int Scanner::scan() const char *p; scan: tok = cur; - loc = cur_loc(); + location = cur_loc(); /*!re2c "{" { lex_code_in_braces(); return TOKEN_CODE; } ":=" { lex_code_indented(); return TOKEN_CODE; } diff --git a/src/parse/scanner.h b/src/parse/scanner.h index 87bec434..2fd26a82 100644 --- a/src/parse/scanner.h +++ b/src/parse/scanner.h @@ -34,7 +34,7 @@ public: private: std::vector files; const conopt_t *globopts; - loc_t loc; + loc_t location; public: Scanner(const conopt_t *o, Msg &m); @@ -93,7 +93,7 @@ inline Scanner::Scanner(const conopt_t *o, Msg &m) , msg(m) , files() , globopts(o) - , loc(ATSTART) + , location(ATSTART) {} inline loc_t Scanner::cur_loc() const @@ -110,7 +110,7 @@ inline loc_t Scanner::cur_loc() const inline const loc_t &Scanner::tok_loc() const { - return loc; + return location; } inline void Scanner::set_line(uint32_t l)