summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-09-15 15:54:48 +0200
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-09-15 15:54:48 +0200
commit4c4c641c4b62f72cd4d807279bc1831b6af8b4a2 (patch)
tree2b0b3fe2ee79875a14771228636cbb540a5fa826 /src/lib
parent11ad2b94fff68c0ed1448598aa5371f6cdb008e9 (diff)
eolian: disallow parsing of warn_unused/owned for funcptrs
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/eolian/eo_parser.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 3600d35..ee0289b 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -971,7 +971,8 @@ typedef struct _Eo_Ret_Def
971} Eo_Ret_Def; 971} Eo_Ret_Def;
972 972
973static void 973static void
974parse_return(Eo_Lexer *ls, Eo_Ret_Def *ret, Eina_Bool allow_void, Eina_Bool allow_def) 974parse_return(Eo_Lexer *ls, Eo_Ret_Def *ret, Eina_Bool allow_void,
975 Eina_Bool allow_def, Eina_Bool is_funcptr)
975{ 976{
976 eo_lexer_get(ls); 977 eo_lexer_get(ls);
977 check_next(ls, ':'); 978 check_next(ls, ':');
@@ -993,7 +994,7 @@ parse_return(Eo_Lexer *ls, Eo_Ret_Def *ret, Eina_Bool allow_void, Eina_Bool allo
993 check_match(ls, ')', '(', line, col); 994 check_match(ls, ')', '(', line, col);
994 } 995 }
995 Eina_Bool has_warn_unused = EINA_FALSE, has_owned = EINA_FALSE; 996 Eina_Bool has_warn_unused = EINA_FALSE, has_owned = EINA_FALSE;
996 for (;;) switch (ls->t.kw) 997 if (!is_funcptr) for (;;) switch (ls->t.kw)
997 { 998 {
998 case KW_at_warn_unused: 999 case KW_at_warn_unused:
999 CASE_LOCK(ls, warn_unused, "warn_unused qualifier"); 1000 CASE_LOCK(ls, warn_unused, "warn_unused qualifier");
@@ -1188,7 +1189,7 @@ parse_accessor:
1188 case KW_return: 1189 case KW_return:
1189 CASE_LOCK(ls, return, "return") 1190 CASE_LOCK(ls, return, "return")
1190 Eo_Ret_Def ret; 1191 Eo_Ret_Def ret;
1191 parse_return(ls, &ret, is_get, EINA_TRUE); 1192 parse_return(ls, &ret, is_get, EINA_TRUE, EINA_FALSE);
1192 pop_type(ls); 1193 pop_type(ls);
1193 if (ret.default_ret_val) pop_expr(ls); 1194 if (ret.default_ret_val) pop_expr(ls);
1194 if (is_get) 1195 if (is_get)
@@ -1403,7 +1404,7 @@ parse_function_pointer(Eo_Lexer *ls)
1403 case KW_return: 1404 case KW_return:
1404 CASE_LOCK(ls, return, "return"); 1405 CASE_LOCK(ls, return, "return");
1405 Eo_Ret_Def ret; 1406 Eo_Ret_Def ret;
1406 parse_return(ls, &ret, EINA_FALSE, EINA_FALSE); 1407 parse_return(ls, &ret, EINA_FALSE, EINA_FALSE, EINA_TRUE);
1407 pop_type(ls); 1408 pop_type(ls);
1408 meth->get_ret_type = ret.type; 1409 meth->get_ret_type = ret.type;
1409 meth->get_return_doc = ret.doc; 1410 meth->get_return_doc = ret.doc;
@@ -1497,7 +1498,7 @@ body:
1497 case KW_return: 1498 case KW_return:
1498 CASE_LOCK(ls, return, "return") 1499 CASE_LOCK(ls, return, "return")
1499 Eo_Ret_Def ret; 1500 Eo_Ret_Def ret;
1500 parse_return(ls, &ret, EINA_FALSE, EINA_TRUE); 1501 parse_return(ls, &ret, EINA_FALSE, EINA_TRUE, EINA_FALSE);
1501 pop_type(ls); 1502 pop_type(ls);
1502 if (ret.default_ret_val) pop_expr(ls); 1503 if (ret.default_ret_val) pop_expr(ls);
1503 meth->get_ret_type = ret.type; 1504 meth->get_ret_type = ret.type;