While building re2c from source (v1.0.2) I've noticed that there are a couple of type conversion warnings popping out during the build process. Here are the warnings:
Warning #1:
rc/ast/parser.cc: In function ‘int yyparse(re2c::context_t&)’:
src/ast/parser.cc:1128:10: warning: conversion to ‘yytype_int16 {aka short int}’ from ‘int’ may alter its value [-Wconversion]
*yyssp = yystate;
^
Here's a proposal to fix this warning, by changing the type of yystate (and yyn) to yytype_int16.
patch1.txt
Warning #2:
src/ast/parser.cc:1133:40: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
YYSIZE_T yysize = yyssp - yyss + 1;
This warning, OTOH, may require some attention, as YYSIZE_T is an unsigned integer type but I believe there are no assurances that the result of (yyssp-yyss + 1) is always positive.
While building re2c from source (v1.0.2) I've noticed that there are a couple of type conversion warnings popping out during the build process. Here are the warnings:
Warning #1:
Here's a proposal to fix this warning, by changing the type of yystate (and yyn) to yytype_int16.
patch1.txt
Warning #2:
This warning, OTOH, may require some attention, as YYSIZE_T is an unsigned integer type but I believe there are no assurances that the result of (yyssp-yyss + 1) is always positive.