]> granicus.if.org Git - re2c/commitdiff
Explicit cast of signed nonnegative to unsigned (found with [-Wsign-conversion]).
authorUlya Trofimovich <skvadrik@gmail.com>
Mon, 24 Aug 2015 09:59:44 +0000 (10:59 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Mon, 24 Aug 2015 09:59:44 +0000 (10:59 +0100)
re2c/src/parse/parser.ypp

index 1e58d3a0b83765c2496f70c9ce48316082d35792..b7e54099a552a44bb1f388b82e4fdf6520e9da8a 100644 (file)
@@ -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<uint32_t> ($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<uint32_t> ($2);
        }
        | CONF_LABELPREFIX STRING ';'
        {