From: Ulya Trofimovich Date: Mon, 24 Aug 2015 09:59:44 +0000 (+0100) Subject: Explicit cast of signed nonnegative to unsigned (found with [-Wsign-conversion]). X-Git-Tag: 0.15~100 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3732f5f279ac996cc8e64c44d06571712febdbf3;p=re2c Explicit cast of signed nonnegative to unsigned (found with [-Wsign-conversion]). --- diff --git a/re2c/src/parse/parser.ypp b/re2c/src/parse/parser.ypp index 1e58d3a0..b7e54099 100644 --- a/re2c/src/parse/parser.ypp +++ b/re2c/src/parse/parser.ypp @@ -136,7 +136,7 @@ void default_rule(CondList *clist, const Code * code) re2c::RegExp * regexp; const re2c::Code * code; char op; - int num; + int32_t num; re2c::ExtOp extop; std::string * str; re2c::CondList * clist; @@ -301,7 +301,11 @@ decl: } | CONF_CGOTO_THRESHOLD NUM ';' { - cGotoThreshold = $2; + if ($2 < 0) + { + in->fatal ("configuration 'cgoto:threshold' must be nonnegative"); + } + cGotoThreshold = static_cast ($2); } | CONF_DEFINE_YYFILL_NAKED NUM ';' { @@ -359,9 +363,9 @@ decl: { if ($2 < 0) { - in->fatal ("configuration 'indent:top' must be a positive integer"); + in->fatal ("configuration 'indent:top' must be nonnegative"); } - topIndent = $2; + topIndent = static_cast ($2); } | CONF_LABELPREFIX STRING ';' {