Commit Graph

163 Commits

Author SHA1 Message Date
Daniel Kolesa 2bfa55582c eolian: remove builtin freefuncs
For now this does not alter API behavior, so freefuncs are still
transitive to aliases etc., this will get removed later.
2019-07-08 16:06:42 +02:00
Daniel Kolesa 5b00dc344f eolian: allow value types in view containers (iterators etc.)
This restricts disallowing value types to containers that can own
them.

It also disallows usage of @owned on those view-only containers,
as that makes no sense.
2019-06-26 14:05:46 +02:00
Daniel Kolesa 1bbf4380ab eolian: add library support for declaring and using errors
You can now declare errors like this:

error Foo = "message"; [[documentation]]

Then you can use them as types like this:

foo {
    return: error(Error1, Error2, ...);
}

They have a separate type category and storage. They are checked
for redefinitions the same as anything else though. This does
not add any generator support nor it adds any advanced checking.

Ref T6890
2019-06-24 15:15:30 +02:00
Daniel Kolesa 9cba6a4f0e eolian: allow complete symbol renaming for C
This adds a new unified syntax for giving declarations C names.

Classes: class @c_name(Foo) Foo ...
Types: type @c_name(Foo) Foo: Bar ...
Structs: struct @c_name(Foo) Foo ...

and so on. Type instances properly inherit those. This also cleans
up some other parts of the source code.

Fixes T6716.
2019-05-30 16:29:51 +02:00
Xavi Artigas 93909d89e5 eolian: allow parts named like methods
Summary:
The C# bindings turn parts into class properties, so part names cannot clash
with method names.
However, a "Part" prefix has been recently added, just like it was done for
events, and therefore this eolian restriction can be lifted.
With this patch part name clashes are only checked among parts, just like it
is done for events.

Relates to D8582

Test Plan: Everything still builds, because we have no part-method name clashes in the tree, but now they are possible.

Reviewers: q66, SanghyeonLee

Reviewed By: q66

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9031
2019-05-28 17:13:49 +02:00
Daniel Kolesa 653fddfc1e eolian: add support for marking and checking parts as beta
Fixes T7837.
2019-05-05 17:07:26 +02:00
Hermet Park 79183150c7 eolian: remove unreachable code. 2019-04-24 13:21:05 +09:00
Daniel Kolesa 3f083b3ccb eolian: add event type call convention checks for non-beta classes 2019-03-21 16:00:18 +01:00
Marcel Hollerbach ab30ff3f9b eolian: enable event redef checking by default
Reviewed-by: Daniel Kolesa <daniel@octaforge.org>
Differential Revision: https://phab.enlightenment.org/D8425
2019-03-21 10:33:56 +01:00
Daniel Kolesa d3c5384cd0 eolian: enable checking of beta/stable contexts in all classes
Summary:
This enables all the checks unconditionally, without ignoring
classes that don't have an Efl namespace. This required a lot
of beta marking to make it build. It most likely doesn't
mark types correctly, as that is not fully enabled yet.

Reviewers: zmike, cedric, segfaultxavi, bu5hm4n

Reviewed By: segfaultxavi

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8266
2019-03-11 13:42:29 +01:00
Marcel Hollerbach e655d20d24 eolian: drop env var checking that is unneccessary
Summary: This now does work, and we can enable the full checks

Reviewers: segfaultxavi, cedric, q66, zmike

Reviewed By: q66

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8276
2019-03-09 16:38:32 +01:00
Daniel Kolesa cf200a7d28 eolian: remove legacy handling API and most of generation
Summary:
This removes all Eolian API that deals with handling of legacy
code. It also removes the code using it in the generator as well
as bindings, but for now keeps generation of .eo.legacy.h types,
as there are still instances in our codebase where things are
otherwise broken. We can remove the rest once that is resolved.

Reviewers: zmike, cedric

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8255
2019-03-08 10:12:09 -05:00
Daniel Kolesa 1a17aff85f eolian: add support for marking type declarations beta
Summary:
This also simplifies the beta checking API by unifying it under
objects (makes much more sense that way) and reworks the validator
to have betaness support within its context state, allowing checks
to be done easily in any place.

The betaness checks are disabled for types for the time being,
because otherwise there are too many errors (types are assumed
to be stable as they are not tagged beta, but they reference beta
classes all over the place). Set EOLIAN_TYPEDECL_BETA_WARN to 1
in your environment to force enable the checks.

Reviewers: zmike, bu5hm4n, stefan_schmidt, lauromoura, cedric

Reviewed By: zmike

Subscribers: #reviewers, #committers

Tags: #efl, #eolian

Differential Revision: https://phab.enlightenment.org/D8102
2019-03-08 08:17:01 -05:00
Daniel Kolesa 4b1622b5fc eolian: remove support for inlist/inarray
This feature was kind of ill-conceived and never worked properly.
Since there isn't enough time to make it work right at this point
and there are no users of it in the API, remove it for now.

It might get added in the next release cycle, in a proper form.

@feature
2019-02-28 20:28:24 +01:00
Daniel Kolesa a9360222b0 eolian: add support for inlist structs
This adds support for inlist structs, a special type of struct
that can only be used with inlists. This differs from regular
structs in a couple ways:

1) They are stored separately. Just like structs, enums, aliases
   have their own storage, so do inlist structs.
2) They can't be @extern, nor they can be opaque.
3) They are their own type of typedecl.
4) When they contain only one field, this field must be a value
   type always, cannot be a pointer.

Like regular structs, they can have arbitrary fields, and they
can have a pre-set free function via @free().

In C, the inlist structs will be generated exactly like ordinary
ones, except they will have EINA_INLIST before the first field.
Other binding generators can deal with them as they wish, for
example to provide high level interfaces to them.

This does not yet do the plumbing necessary to hook these into
the type system, nor it adds generator support.

@feature
2019-02-28 00:52:14 +01:00
Marcel Hollerbach d0709d6110 eolian: validate betaness
Summary:
if there is a none beta class, then this class should not depend on beta
classes in parameters / event types / return types, parent inherits.
This adds this validation, so we can start to slowly to unbeta more and
more classes.

Reviewers: q66, zmike, cedric, segfaultxavi

Reviewed By: q66

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7999
2019-02-25 14:00:28 +01:00
Daniel Kolesa dc492b1586 eolian: introduce typed slice types
Summary:
This adds two new complex types, slice<T> and rw_slice<T>. This
is necessary to make the type useful to bindings, as Eina_Slice
on its own says nothing about what it's carrying and that prevents
useful code from being generated outside of C.

@feature

Reviewers: bu5hm4n, segfaultxavi, lauromoura, cedric

Reviewed By: cedric

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7980
2019-02-22 16:18:49 +01:00
Daniel Kolesa ca82c27d18 eolian: clear the unimplemented implement set for each tree
We keep a hash tracking implements that were already errored on
so that we don't print some errors multiple times. The problem is
that it wasn't getting cleared when switching to a new inheritance
tree so errors from an interface implemented in multiple distinct
inheritance trees would only get printed once.
2019-01-25 14:13:16 +01:00
Daniel Kolesa 7b2ef21b90 eolian: check old impl status before actually trying to extend it
Since _extend_impl always marks the impl at least IMPL_STATUS_NONE,
we need to retrieve the original status before calling into it,
or it will get overwritten and will inadvertently disable some
of the checks.
2019-01-23 19:28:25 +01:00
Daniel Kolesa d9dbf88621 eolian: get rid of false positives about unimplemented methods
We worked under the assumption that when inheriting callables
from a regular class, it's good enough to just set those as
fully implemented, because the underlying class is already
checked. This assumption is wrong, as the callables may contain
multiple implements pointing at the same function (consider when
a regular class implements just the get part of a property but
some underlying class implements it whole) - the old logic would
result in just the first reached implement (possibly incomplete)
being added into callables of the inheriting class, which results
in false positives.

Consider this example:

class A has a fully implemented property foo
class B inherits from A and partially implements foo
abstract C inherits from B
class D inherits from C

abstract C would go over B's implements, encounter the first
partial implementation of foo, adding it into its own callables
and marking it as fully implemented (because it came from an
already checked regular class B), which would result in the
other implement being skipped.

So make no assumptions and use the same logic for all class types.

Of course, this brings in another problem: some errors would now
get printed twice, because if you have a class A which has funcs
that are unimplemented and class B inheriting from it, errors would
get printed for A but also for B, which would include A's errors.

To battle that, introduce a "global" (well, local to the entry
point of the validator) hash tracking which implements have already
been errored on; and skip those appropriately.
2019-01-23 18:08:05 +01:00
Daniel Kolesa 0cd3a3602e eolian: refactor validator error logging
It hasn't been necessary to keep these temporary buffers around
for quite a while, nobody just got around to remove them. Eolian
has a good formattable error logging system in its core now.

Also, use same erroring style on parts as on functions, i.e.
batch-print all the conflicts at once.
2019-01-23 16:23:59 +01:00
Daniel Kolesa 8a8188d310 eolian: inherit composite lists and allow in abstracts/mixins
There isn't any more logic necessary because checks are still only
done on regular classes; we just need to make sure that composite
lists from its inheritance tree are accounted for.
2019-01-23 16:01:24 +01:00
Marcel Hollerbach d6c207772f eolian: error out when owned type does not have a free function
if there is no free function, then there is no way that this value is
owned by the caller,

Reviewed-by: Daniel Kolesa <daniel@octaforge.org>
Differential Revision: https://phab.enlightenment.org/D7712
2019-01-23 14:13:32 +01:00
Daniel Kolesa 7feeda0410 eolian: add support for composite section into regular classes
Each regular class can now have a section called 'composite',
which can contain interfaces and interfaces only. This defines
a list of interfaces that are allowed to be unimplemented on the
class, as it is assumed the class will be composited with some
other class implementing those interfaces.

Only regular classes can have this, as only regular classes can
be instantiated.

It will also be necessary to check whether the classes in the
section appear somewhere within the inheritance tree. For now,
this testing is not being done.

Example of usage:

composite {
    Some.Magic.Interface;
    Another.Magic.Interface;
}

directly in the class body.
2019-01-21 17:19:14 +01:00
Marcel Hollerbach 270cb385ca eolian: make error messages usable
base of the impl is where the function is defined, not where the missing
implementation is.

ref T5719

Reviewed-by: Daniel Kolesa <daniel@octaforge.org>
Differential Revision: https://phab.enlightenment.org/D7680
2019-01-17 21:00:05 +01:00
Daniel Kolesa 18ab4f2eec eolian: disallow pure virtual on non-abstract/mixin classes 2019-01-17 17:17:40 +01:00
Daniel Kolesa 1b7129cea0 eolian: enforce not using regular classes in extension list 2019-01-17 16:17:42 +01:00
Daniel Kolesa 24df96b1b6 eolian: always enable regular-class-in-extensions-list checking
For now it just warns and doesn't error. It will become an error
once all occurences are fixed.
2019-01-17 15:31:22 +01:00
Daniel Kolesa ceac54b23b eolian: warn as much as possible at once for unimplemented funcs
This also fixes some other potential errors, when there is a
failure about unimplemented methods but something up the stack
then uses those results.
2019-01-17 14:16:26 +01:00
Daniel Kolesa eb830d8e46 eolian: disallow pure virtual methods in regular classes
This is a currently optional check.

Use EOLIAN_PURE_VIRTUAL_WARN=1 to enable.
2019-01-16 20:30:02 +01:00
Daniel Kolesa 2110641131 eolian: add validation to make sure all methods are implemented
The checks are only done for regular classes. It's also disabled
by default as too many methods would be unimplemented.

Use EOLIAN_CLASS_UNIMPLEMENTED_WARN=1 to enable the errors.
2019-01-16 19:41:40 +01:00
Marcel Hollerbach 2b1285c9db eolian: add free functions for the array and future.
It appears that NULL is not really usefull here, as this will lead to
errors later on. (void) will force the free function to just do nothing
and be later converted to a NOP.

Reviewed-by: Daniel Kolesa <daniel@octaforge.org>
Differential Revision: https://phab.enlightenment.org/D7629
2019-01-16 14:34:34 +01:00
Marcel Hollerbach 77cfb1299c eolian: there is no eina_inlist_free
Reviewed-by: Daniel Kolesa <daniel@octaforge.org>
Differential Revision: https://phab.enlightenment.org/D7628
2019-01-16 14:34:33 +01:00
Marcel Hollerbach 455dedd49d eolian: introduce the keyword required
This introduces a new keyword called required. It only works on mixins.
You can specify a list of regular/abstract classes in there.
Classes specified after the required keyword are later used to verify
the usage of the mixin. With this feature a mixin can define a list of
types that the inheriting object (the object that inherits from a mixin)
needs to fullfill, if one class that is required is not in the
implemented classes, then eolian will bail out.

Differential Revision: https://phab.enlightenment.org/D7584
2019-01-11 12:37:27 +01:00
Daniel Kolesa 454e9eb1d9 eolian: add optional warning for regular classes in ext list
As per T7240, we intend to disallow multi-class inheritance in Eo
at some point. In order to achieve that, it is necessary to find
out which classes still use multi-class inheritance and change
them accordingly.

Eo multi-class inheritance is not actually multi-class, as doing
so will simply treat all the other classes as interfaces, which
is misleading and poor design on its own.

By setting EOLIAN_CLASS_REGULAR_AS_EXT_WARN environment variable,
Eolian will now warn about such classes, allowing them to be
fixed.

Closes T7365.
2018-11-30 14:15:13 +01:00
Daniel Kolesa 14ce54c303 eolian: implement new inherit behavior
Eolian now separates 'parent' and 'extensions'. For regular
classes, parent is the first item in the inherits list and
extesions is the rest. For interfaces and mixins, parent is
NULL and extends is the inherits list.

The reason for this is the separation of them in syntax in near
future. It also slightly changes the behavior; since for interfaces
and mixins, parent is always NULL now, you can freely inherit from
all types of classes without needing to manually put an interface
type as the first item of the inherits list.
2018-11-23 13:57:07 +01:00
Daniel Kolesa 9535eff025 eolian: check whether events conflict in inheritance tree (off)
Previously, the EOLIAN_EVENT_REDEF_WARN environment variable
enabled extra checks that would include events in checking
conflicts against methods. Since this is probably not necessary
and naming events the same as methods is perfectly fine in itself,
relax this rule and check events completely independently.

In practice, this will disallow using the same name for two
events within the same inheritance tree, which is desirable
in longer term, but cannot be enabled just yet because we have
too many of those conflicts. But it also allows the events to
be named the same as methods or parts, which is fine and was not
possible before.
2018-11-21 16:29:08 +01:00
Daniel Kolesa 04c4bb5834 eolian: use 'free' for owned mstring but not string
Summary:
Strings are const and if these are meant to be owned then it
should define its own special free func. Mstrings are mutable
and therefore can be owned and freed using standard free() by
default.

This fixes some warnings around the EFL caused by empty fallback
free funcs created by the eolian generator, and these mutable
strings were not being freed and potentially leaked.

Reviewers: bu5hm4n, stefan_schmidt

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7261
2018-11-15 12:16:42 +01:00
Daniel Kolesa d0c96539f2 eolian: add eolian_implement_implementing_class_get
This will make it easier for generators and utilities to retrieve
the class that implemented a method/property/etc rather than the
class the implement was originally defined for. Thanks to this
it will no longer be necessary to carry the class pointer around
the place.
2018-11-04 16:12:53 +01:00
Daniel Kolesa 175b25ab2e eolian: integrate event type requirement into eo file grammar 2018-05-19 01:49:06 +02:00
Daniel Kolesa f747df69f9 eolian: force-enable event type checks
Now that event types have all been fixed, force-enable the
validation check.
2018-05-19 01:45:38 +02:00
Daniel Kolesa 3685bcd61d eolian: add optional warnings about events missing a type
Set the EOLIAN_EVENT_NO_TYPE_WARN environment variable to enable
those warnings during Eolian usage. They will be considered a part
of the validation then.

Use the void type for events to suppress the warning.
2018-05-09 15:44:36 +02:00
Daniel Kolesa 3a55fe0bbf eolian: allow void and non-ownable types in future 2018-05-03 17:14:39 +02:00
Daniel Kolesa c116695311 eolian: add builtin type for Eina_Future 2018-05-03 17:14:39 +02:00
Cedric BAIL 042de32421 eolian: remove old support for Efl_Future. 2018-05-01 10:39:01 -07:00
Daniel Kolesa bef66f507d eolian: check event vs function/part conflicts as well
Still behind the env var, because there would be a lot of failures
otherwise.
2018-04-26 16:41:32 +02:00
Daniel Kolesa d810c1e71d eolian: use pointer hashes in validation for performance
We can use pointer hashes because the keys will have the same
addresses during validation. This should be faster, so do that.
2018-04-26 16:23:13 +02:00
Daniel Kolesa a0e7564836 eolian: stricter function/part redef checks
Now we also check part redefinitions and function redefinitions
are checked against parts as well.
2018-04-26 16:15:04 +02:00
Daniel Kolesa f796a21d72 eolian: add event redefinition checks
As EFL fails build with this enabled, hide these behind the
EOLIAN_EVENT_REDEF_WARN environment variable for the time being.
2018-04-26 16:15:04 +02:00
Daniel Kolesa 6f69a8c56d eolian: clear chash on each iteration during validation
This is necessary because inheritance trees need to be validated
individually for proper name conflict checks. It also prevents
eina_hash_add related errors.
2018-04-26 16:15:04 +02:00