From 4242e94a17bd9ce3d1e2701ddd9ed47d8b7e3238 Mon Sep 17 00:00:00 2001 From: Prasad Joshi Date: Thu, 30 Jun 2011 13:03:29 +0100 Subject: [PATCH] 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 --- parse.y | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/parse.y b/parse.y index 285996075..b7b228592 100644 --- a/parse.y +++ b/parse.y @@ -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