Function definition without return type

The patch allows parsing of function definitions which do not have
explicit data type or range. The default return data type is assumed
to be reg unsigned and the default range is 0.

Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
This commit is contained in:
Prasad Joshi 2011-06-30 13:03:29 +01:00 committed by Stephen Williams
parent e497c1f1dc
commit 4242e94a17
1 changed files with 10 additions and 4 deletions

14
parse.y
View File

@ -3506,9 +3506,16 @@ dimensions
/* This is used to express the return type of a function. */
function_range_or_type_opt
: range { $$.range = make_range_vector($1); $$.type = PTF_REG; }
| K_signed range { $$.range = make_range_vector($2); $$.type = PTF_REG_S; }
| K_unsigned range { $$.range = make_range_vector($2); $$.type = PTF_REG; }
: unsigned_signed_opt range_opt
{
/* the default type is reg unsigned and no range */
$$.type = PTF_REG;
$$.range = 0;
if ($1)
$$.type = PTF_REG_S;
if ($2)
$$.range = make_range_vector($2);
}
| K_reg unsigned_signed_opt range_opt
{
/* the default type is reg unsigned and no range */
@ -3526,7 +3533,6 @@ function_range_or_type_opt
| atom2_type { $$.range = make_range_vector($1); $$.type = PTF_ATOM2_S; }
| atom2_type K_signed { $$.range = make_range_vector($1); $$.type = PTF_ATOM2_S; }
| atom2_type K_unsigned { $$.range = make_range_vector($1); $$.type = PTF_ATOM2; }
| { $$.range = 0; $$.type = PTF_REG; }
;
/* The register_variable rule is matched only when I am parsing