Commit Graph

185 Commits

Author SHA1 Message Date
Daniel Kolesa 81441638db eolian: enable unimplemented function errors for stable API 2019-09-17 12:36:50 +02:00
Daniel Kolesa afc011d893 eolian: hard ban usage of ptr() in stable API 2019-09-10 14:35:41 +02:00
Daniel Kolesa 5cd851ea25 eolian: consider @by_ref marked elements ownable 2019-09-10 14:10:49 +02:00
Daniel Kolesa b880a1c7e8 eolian: add an optional warning for ptr() usage in stable API 2019-09-10 14:06:46 +02:00
Daniel Kolesa 917b5feb27 eolian: make sure to include by_ref in validation of expressions 2019-09-04 18:26:13 +02:00
Daniel Kolesa d7397aca4d eolian: proper error message for @by_ref on pointer types 2019-09-04 16:27:54 +02:00
Daniel Kolesa fdc85f895d eolian: properly handle non-beta restriction of __undefined_type 2019-08-31 14:02:20 +02:00
Daniel Kolesa 3e22ac3e1c eolian: always validate inner types of complex types for @move 2019-08-31 02:14:04 +02:00
Daniel Kolesa 5e5bfc70e5 eolian: refactor ownability validation to accommodate new syntax
This refactors ownability checks so that they're only performed
in contexts where @move can be specified, which both helps
with performance and enables later removal of ownability info
from types themselves.
2019-08-31 01:58:19 +02:00
Daniel Kolesa b1d147abf4 eolian: validate @by_ref correctness
The @by_ref qualifier can only be used with value types, to
guarantee exactly one level of pointers.
2019-08-31 01:58:19 +02:00
Daniel Kolesa 66b0555f59 eolian: disallow legacy keyword in enums in stable api
This also marks a bunch of users of that as beta, as they were
effectively beta.
2019-08-29 15:06:08 +02:00
Daniel Kolesa 510d437246 eolian: add an envvar to warn about unimplemented beta funcs
This changes the behavior of the existing env var to only check
unimplemented functions in stable APIs by default. Beta checks
can be enabled with an additional environment var, so use
EOLIAN_CLASS_UNIMPLEMENTED_WARN for stable and
EOLIAN_CLASS_UNIMPLEMENTED_BETA_WARN for extra beta checks.
2019-08-09 16:10:41 +02:00
Daniel Kolesa 80fb8727b5 eolian: refactor "dead" code
This has no functional change but should stop coverity from
complaining.

CID1382214
2019-08-05 15:37:13 +02:00
Daniel Kolesa 1c5fa59ee8 eolian: remove __builtin_free_cb
This has long been unused. If we need to replace this eventually,
it should be done correctly.
2019-08-01 16:55:31 +02:00
Daniel Kolesa 1bcca58d82 eolian: disallow ptr() in containers in stable API 2019-08-01 16:55:31 +02:00
Daniel Kolesa a17d3300bd eolian: make strbuf ownable 2019-07-30 15:57:52 +02:00
Daniel Kolesa 1348569bfa eolian: allow value types in owning containers (list/array/etc) 2019-07-26 14:13:50 +02:00
Daniel Kolesa 0259f98472 eolian: also ban underscore prefixed builtins in stable API 2019-07-26 13:38:01 +02:00
Daniel Kolesa 635a2df7e7 eolian: ban void_ptr in stable APIs
This required some refactoring in eldbus and tests but otherwise
seems good to go.
2019-07-26 13:35:27 +02:00
Daniel Kolesa 65b4782682 eolian: remove support for old free() syntax
Now freefuncs can only be specified on type declarations but not
on types themselves. Also remove transitiveness of freefuncs.
2019-07-17 20:15:35 +02:00
Daniel Kolesa f62d0dc36b eolian: allow binbufs to be owned 2019-07-17 18:15:01 +02:00
Daniel Kolesa 61f39eef49 eolian: remove API to get freefunc of type
This is not supported anymore. For now, the syntax is kept
around because of broken C++ tests, but afterwards it will
also be removed.
2019-07-08 16:06:42 +02:00
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