diff options
author | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2017-09-22 18:08:36 +0200 |
---|---|---|
committer | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2017-09-22 18:08:36 +0200 |
commit | a6e5caba10228d2fd63f7ffe6715b582bc49814a (patch) | |
tree | 67be2e66ef184685da7110e2d1f09266eff1f2d0 | |
parent | 1577c576e6141eeb80f9e6c7018310690bb1d8bc (diff) |
eolian: remove leftover code
-rw-r--r-- | src/lib/eolian/database_expr_api.c | 2 | ||||
-rw-r--r-- | src/lib/eolian/database_type.c | 13 | ||||
-rw-r--r-- | src/lib/eolian/database_validate.c | 2 | ||||
-rw-r--r-- | src/lib/eolian/eo_parser.c | 39 | ||||
-rw-r--r-- | src/lib/eolian/eolian_database.h | 2 |
5 files changed, 27 insertions, 31 deletions
diff --git a/src/lib/eolian/database_expr_api.c b/src/lib/eolian/database_expr_api.c index 50a0afab44..9e8e1f61fd 100644 --- a/src/lib/eolian/database_expr_api.c +++ b/src/lib/eolian/database_expr_api.c | |||
@@ -29,7 +29,7 @@ _eval_type(const Eolian_Unit *unit, const Eolian_Expression *expr, | |||
29 | return database_expr_eval(unit, expr, EOLIAN_MASK_NULL); | 29 | return database_expr_eval(unit, expr, EOLIAN_MASK_NULL); |
30 | case EOLIAN_TYPE_REGULAR: | 30 | case EOLIAN_TYPE_REGULAR: |
31 | { | 31 | { |
32 | if (database_type_is_ownable(type, EINA_FALSE)) | 32 | if (database_type_is_ownable(type)) |
33 | return database_expr_eval(unit, expr, EOLIAN_MASK_NULL); | 33 | return database_expr_eval(unit, expr, EOLIAN_MASK_NULL); |
34 | int kw = eo_lexer_keyword_str_to_id(type->name); | 34 | int kw = eo_lexer_keyword_str_to_id(type->name); |
35 | if (!kw || kw < KW_byte || kw >= KW_void) | 35 | if (!kw || kw < KW_byte || kw >= KW_void) |
diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c index dda298fbe2..1afbbac14a 100644 --- a/src/lib/eolian/database_type.c +++ b/src/lib/eolian/database_type.c | |||
@@ -80,17 +80,14 @@ static const Eina_Bool _ownable_types[] = { | |||
80 | }; | 80 | }; |
81 | 81 | ||
82 | Eina_Bool | 82 | Eina_Bool |
83 | database_type_is_ownable(const Eolian_Type *tp, Eina_Bool term) | 83 | database_type_is_ownable(const Eolian_Type *tp) |
84 | { | 84 | { |
85 | if (tp->is_ptr) | 85 | if (tp->is_ptr) |
86 | return EINA_TRUE; | 86 | return EINA_TRUE; |
87 | if (tp->type == EOLIAN_TYPE_REGULAR) | 87 | if (tp->type == EOLIAN_TYPE_REGULAR) |
88 | { | 88 | { |
89 | int kwid = eo_lexer_keyword_str_to_id(tp->name); | 89 | int kw = eo_lexer_keyword_str_to_id(tp->name); |
90 | /* don't include bool, it only has 2 values so it's useless */ | 90 | const char *ct = eo_lexer_get_c_type(kw); |
91 | if (term && (kwid >= KW_byte && kwid < KW_bool)) | ||
92 | return EINA_TRUE; | ||
93 | const char *ct = eo_lexer_get_c_type(kwid); | ||
94 | if (!ct) | 91 | if (!ct) |
95 | { | 92 | { |
96 | const Eolian_Typedecl *tpp = eolian_type_typedecl_get(tp); | 93 | const Eolian_Typedecl *tpp = eolian_type_typedecl_get(tp); |
@@ -99,7 +96,7 @@ database_type_is_ownable(const Eolian_Type *tp, Eina_Bool term) | |||
99 | if (tpp->type == EOLIAN_TYPEDECL_FUNCTION_POINTER) | 96 | if (tpp->type == EOLIAN_TYPEDECL_FUNCTION_POINTER) |
100 | return EINA_TRUE; | 97 | return EINA_TRUE; |
101 | if (tpp->type == EOLIAN_TYPEDECL_ALIAS) | 98 | if (tpp->type == EOLIAN_TYPEDECL_ALIAS) |
102 | return database_type_is_ownable(tpp->base_type, term); | 99 | return database_type_is_ownable(tpp->base_type); |
103 | return EINA_FALSE; | 100 | return EINA_FALSE; |
104 | } | 101 | } |
105 | return (ct[strlen(ct) - 1] == '*'); | 102 | return (ct[strlen(ct) - 1] == '*'); |
@@ -124,7 +121,7 @@ database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name, | |||
124 | || tp->type == EOLIAN_TYPE_CLASS | 121 | || tp->type == EOLIAN_TYPE_CLASS |
125 | || tp->type == EOLIAN_TYPE_VOID) | 122 | || tp->type == EOLIAN_TYPE_VOID) |
126 | && tp->is_const | 123 | && tp->is_const |
127 | && ((ctype != EOLIAN_C_TYPE_RETURN) || database_type_is_ownable(tp, EINA_FALSE))) | 124 | && ((ctype != EOLIAN_C_TYPE_RETURN) || database_type_is_ownable(tp))) |
128 | { | 125 | { |
129 | eina_strbuf_append(buf, "const "); | 126 | eina_strbuf_append(buf, "const "); |
130 | } | 127 | } |
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c index 0a296224da..7ef27acdd3 100644 --- a/src/lib/eolian/database_validate.c +++ b/src/lib/eolian/database_validate.c | |||
@@ -149,7 +149,7 @@ _validate_type(Eolian_Type *tp) | |||
149 | { | 149 | { |
150 | char buf[256]; | 150 | char buf[256]; |
151 | 151 | ||
152 | if (tp->owned && !database_type_is_ownable(tp, EINA_FALSE)) | 152 | if (tp->owned && !database_type_is_ownable(tp)) |
153 | { | 153 | { |
154 | snprintf(buf, sizeof(buf), "type '%s' is not ownable", tp->full_name); | 154 | snprintf(buf, sizeof(buf), "type '%s' is not ownable", tp->full_name); |
155 | return _type_error(tp, buf); | 155 | return _type_error(tp, buf); |
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index a3bdc8c41c..a1e27134bf 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c | |||
@@ -455,15 +455,14 @@ parse_expr(Eo_Lexer *ls) | |||
455 | return parse_expr_bin(ls, 1); | 455 | return parse_expr_bin(ls, 1); |
456 | } | 456 | } |
457 | 457 | ||
458 | static Eolian_Type *parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ref, | 458 | static Eolian_Type *parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ref); |
459 | Eina_Bool allow_sarray); | ||
460 | 459 | ||
461 | static Eolian_Type * | 460 | static Eolian_Type * |
462 | parse_type(Eo_Lexer *ls, Eina_Bool allow_ref, Eina_Bool allow_sarray) | 461 | parse_type(Eo_Lexer *ls, Eina_Bool allow_ref) |
463 | { | 462 | { |
464 | Eolian_Type *ret; | 463 | Eolian_Type *ret; |
465 | eo_lexer_context_push(ls); | 464 | eo_lexer_context_push(ls); |
466 | ret = parse_type_void(ls, allow_ref, allow_sarray); | 465 | ret = parse_type_void(ls, allow_ref); |
467 | if (ret->type == EOLIAN_TYPE_VOID) | 466 | if (ret->type == EOLIAN_TYPE_VOID) |
468 | { | 467 | { |
469 | eo_lexer_context_restore(ls); | 468 | eo_lexer_context_restore(ls); |
@@ -512,7 +511,7 @@ parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern, | |||
512 | def->field_list = eina_list_append(def->field_list, fdef); | 511 | def->field_list = eina_list_append(def->field_list, fdef); |
513 | eo_lexer_get(ls); | 512 | eo_lexer_get(ls); |
514 | check_next(ls, ':'); | 513 | check_next(ls, ':'); |
515 | tp = parse_type(ls, EINA_TRUE, EINA_TRUE); | 514 | tp = parse_type(ls, EINA_TRUE); |
516 | FILL_BASE(fdef->base, ls, fline, fcol); | 515 | FILL_BASE(fdef->base, ls, fline, fcol); |
517 | fdef->type = tp; | 516 | fdef->type = tp; |
518 | fdef->name = eina_stringshare_ref(fname); | 517 | fdef->name = eina_stringshare_ref(fname); |
@@ -687,7 +686,7 @@ _parse_dep(Eo_Lexer *ls, const char *fname, const char *name) | |||
687 | } | 686 | } |
688 | 687 | ||
689 | static Eolian_Type * | 688 | static Eolian_Type * |
690 | parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ref, Eina_Bool allow_sarray) | 689 | parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ref) |
691 | { | 690 | { |
692 | Eolian_Type *def; | 691 | Eolian_Type *def; |
693 | Eina_Strbuf *buf; | 692 | Eina_Strbuf *buf; |
@@ -701,7 +700,7 @@ parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ref, Eina_Bool allow_sarray) | |||
701 | pline = ls->line_number; | 700 | pline = ls->line_number; |
702 | pcol = ls->column; | 701 | pcol = ls->column; |
703 | check_next(ls, '('); | 702 | check_next(ls, '('); |
704 | def = parse_type_void(ls, allow_ref, EINA_FALSE); | 703 | def = parse_type_void(ls, allow_ref); |
705 | FILL_BASE(def->base, ls, line, col); | 704 | FILL_BASE(def->base, ls, line, col); |
706 | def->is_const = EINA_TRUE; | 705 | def->is_const = EINA_TRUE; |
707 | check_match(ls, ')', '(', pline, pcol); | 706 | check_match(ls, ')', '(', pline, pcol); |
@@ -714,7 +713,7 @@ parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ref, Eina_Bool allow_sarray) | |||
714 | pline = ls->line_number; | 713 | pline = ls->line_number; |
715 | pcol = ls->column; | 714 | pcol = ls->column; |
716 | check_next(ls, '('); | 715 | check_next(ls, '('); |
717 | def = parse_type_void(ls, EINA_FALSE, EINA_FALSE); | 716 | def = parse_type_void(ls, EINA_FALSE); |
718 | FILL_BASE(def->base, ls, line, col); | 717 | FILL_BASE(def->base, ls, line, col); |
719 | def->is_ptr = EINA_TRUE; | 718 | def->is_ptr = EINA_TRUE; |
720 | check_match(ls, ')', '(', pline, pcol); | 719 | check_match(ls, ')', '(', pline, pcol); |
@@ -727,7 +726,7 @@ parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ref, Eina_Bool allow_sarray) | |||
727 | pline = ls->line_number; | 726 | pline = ls->line_number; |
728 | pcolumn = ls->column; | 727 | pcolumn = ls->column; |
729 | check_next(ls, '('); | 728 | check_next(ls, '('); |
730 | def = parse_type_void(ls, allow_ref, EINA_FALSE); | 729 | def = parse_type_void(ls, allow_ref); |
731 | check_next(ls, ','); | 730 | check_next(ls, ','); |
732 | check(ls, TOK_VALUE); | 731 | check(ls, TOK_VALUE); |
733 | def->freefunc = eina_stringshare_ref(ls->t.value.s); | 732 | def->freefunc = eina_stringshare_ref(ls->t.value.s); |
@@ -766,23 +765,23 @@ parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ref, Eina_Bool allow_sarray) | |||
766 | int bline = ls->line_number, bcol = ls->column; | 765 | int bline = ls->line_number, bcol = ls->column; |
767 | check_next(ls, '<'); | 766 | check_next(ls, '<'); |
768 | if (tpid == KW_future) | 767 | if (tpid == KW_future) |
769 | def->base_type = parse_type_void(ls, EINA_FALSE, EINA_FALSE); | 768 | def->base_type = parse_type_void(ls, EINA_FALSE); |
770 | else | 769 | else |
771 | def->base_type = parse_type(ls, EINA_FALSE, EINA_FALSE); | 770 | def->base_type = parse_type(ls, EINA_FALSE); |
772 | pop_type(ls); | 771 | pop_type(ls); |
773 | if ((def->base_type->owned = (ls->t.kw == KW_at_owned))) | 772 | if ((def->base_type->owned = (ls->t.kw == KW_at_owned))) |
774 | eo_lexer_get(ls); | 773 | eo_lexer_get(ls); |
775 | if (tpid == KW_hash) | 774 | if (tpid == KW_hash) |
776 | { | 775 | { |
777 | check_next(ls, ','); | 776 | check_next(ls, ','); |
778 | def->base_type->next_type = parse_type(ls, EINA_FALSE, EINA_FALSE); | 777 | def->base_type->next_type = parse_type(ls, EINA_FALSE); |
779 | pop_type(ls); | 778 | pop_type(ls); |
780 | if ((def->base_type->next_type->owned = (ls->t.kw == KW_at_owned))) | 779 | if ((def->base_type->next_type->owned = (ls->t.kw == KW_at_owned))) |
781 | eo_lexer_get(ls); | 780 | eo_lexer_get(ls); |
782 | } | 781 | } |
783 | else if((tpid == KW_future) && test_next(ls, ',')) | 782 | else if((tpid == KW_future) && test_next(ls, ',')) |
784 | { | 783 | { |
785 | def->base_type->next_type = parse_type_void(ls, EINA_FALSE, EINA_FALSE); | 784 | def->base_type->next_type = parse_type_void(ls, EINA_FALSE); |
786 | pop_type(ls); | 785 | pop_type(ls); |
787 | } | 786 | } |
788 | check_match(ls, '>', '<', bline, bcol); | 787 | check_match(ls, '>', '<', bline, bcol); |
@@ -852,7 +851,7 @@ parse_typedef(Eo_Lexer *ls) | |||
852 | } | 851 | } |
853 | eo_lexer_context_pop(ls); | 852 | eo_lexer_context_pop(ls); |
854 | check_next(ls, ':'); | 853 | check_next(ls, ':'); |
855 | def->base_type = parse_type(ls, EINA_FALSE, EINA_FALSE); | 854 | def->base_type = parse_type(ls, EINA_FALSE); |
856 | pop_type(ls); | 855 | pop_type(ls); |
857 | check_next(ls, ';'); | 856 | check_next(ls, ';'); |
858 | FILL_DOC(ls, def, doc); | 857 | FILL_DOC(ls, def, doc); |
@@ -888,7 +887,7 @@ parse_variable(Eo_Lexer *ls, Eina_Bool global) | |||
888 | } | 887 | } |
889 | eo_lexer_context_pop(ls); | 888 | eo_lexer_context_pop(ls); |
890 | check_next(ls, ':'); | 889 | check_next(ls, ':'); |
891 | def->base_type = parse_type(ls, EINA_FALSE, EINA_FALSE); | 890 | def->base_type = parse_type(ls, EINA_FALSE); |
892 | pop_type(ls); | 891 | pop_type(ls); |
893 | /* constants are required to have a value */ | 892 | /* constants are required to have a value */ |
894 | if (!global) | 893 | if (!global) |
@@ -924,9 +923,9 @@ parse_return(Eo_Lexer *ls, Eo_Ret_Def *ret, Eina_Bool allow_void, | |||
924 | eo_lexer_get(ls); | 923 | eo_lexer_get(ls); |
925 | check_next(ls, ':'); | 924 | check_next(ls, ':'); |
926 | if (allow_void) | 925 | if (allow_void) |
927 | ret->type = parse_type_void(ls, EINA_TRUE, EINA_FALSE); | 926 | ret->type = parse_type_void(ls, EINA_TRUE); |
928 | else | 927 | else |
929 | ret->type = parse_type(ls, EINA_TRUE, EINA_FALSE); | 928 | ret->type = parse_type(ls, EINA_TRUE); |
930 | ret->doc = NULL; | 929 | ret->doc = NULL; |
931 | ret->default_ret_val = NULL; | 930 | ret->default_ret_val = NULL; |
932 | ret->warn_unused = EINA_FALSE; | 931 | ret->warn_unused = EINA_FALSE; |
@@ -992,9 +991,9 @@ parse_param(Eo_Lexer *ls, Eina_List **params, Eina_Bool allow_inout, | |||
992 | eo_lexer_get(ls); | 991 | eo_lexer_get(ls); |
993 | check_next(ls, ':'); | 992 | check_next(ls, ':'); |
994 | if (par->param_dir == EOLIAN_OUT_PARAM || par->param_dir == EOLIAN_INOUT_PARAM) | 993 | if (par->param_dir == EOLIAN_OUT_PARAM || par->param_dir == EOLIAN_INOUT_PARAM) |
995 | par->type = parse_type_void(ls, EINA_TRUE, EINA_FALSE); | 994 | par->type = parse_type_void(ls, EINA_TRUE); |
996 | else | 995 | else |
997 | par->type = parse_type(ls, EINA_TRUE, EINA_FALSE); | 996 | par->type = parse_type(ls, EINA_TRUE); |
998 | pop_type(ls); | 997 | pop_type(ls); |
999 | if ((is_vals || (par->param_dir == EOLIAN_OUT_PARAM)) && (ls->t.token == '(')) | 998 | if ((is_vals || (par->param_dir == EOLIAN_OUT_PARAM)) && (ls->t.token == '(')) |
1000 | { | 999 | { |
@@ -1752,7 +1751,7 @@ end: | |||
1752 | if (ls->t.token == ':') | 1751 | if (ls->t.token == ':') |
1753 | { | 1752 | { |
1754 | eo_lexer_get(ls); | 1753 | eo_lexer_get(ls); |
1755 | ev->type = parse_type(ls, EINA_TRUE, EINA_FALSE); | 1754 | ev->type = parse_type(ls, EINA_TRUE); |
1756 | ev->type->owned = has_owned; | 1755 | ev->type->owned = has_owned; |
1757 | pop_type(ls); | 1756 | pop_type(ls); |
1758 | } | 1757 | } |
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h index 1a165a42e8..9858db4c31 100644 --- a/src/lib/eolian/eolian_database.h +++ b/src/lib/eolian/eolian_database.h | |||
@@ -313,7 +313,7 @@ void database_typedecl_del(Eolian_Typedecl *tp); | |||
313 | void database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name, Eolian_C_Type_Type ctype); | 313 | void database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name, Eolian_C_Type_Type ctype); |
314 | void database_typedecl_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, Eina_Strbuf *buf); | 314 | void database_typedecl_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, Eina_Strbuf *buf); |
315 | 315 | ||
316 | Eina_Bool database_type_is_ownable(const Eolian_Type *tp, Eina_Bool term); | 316 | Eina_Bool database_type_is_ownable(const Eolian_Type *tp); |
317 | 317 | ||
318 | /* expressions */ | 318 | /* expressions */ |
319 | 319 | ||