Commit Graph

432 Commits

Author SHA1 Message Date
WooHyun Jung 5827fdb3cb Revert "eolian: inherit since information from struct to field"
This reverts commit f349510941.

This patch is causing some "ninja test" errors, so the errors
should be fixed first.
2019-12-23 17:54:21 +09:00
Felipe Magno de Almeida f349510941 eolian: inherit since information from struct to field
Summary:
If struct field doesn't explicitly sets since information, then since
is inherited from struct documentation if it is available.

Reviewers: jptiz, Jaehyun_Cho, woohyun, q66

Reviewed By: q66

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8359

Differential Revision: https://phab.enlightenment.org/D10948
2019-12-23 10:21:31 +09:00
Daniel Kolesa c601944a13 eolian: fix a parse bug where composites was treated as implements
In the specific case where you had "class A extends B composites C"
the correct composites branch was ignored and instead the implements
branch was used. This was entirely wrong/an oversight that did not
appear until now. Other combinations were handled correctly.
2019-12-04 16:07:09 +01:00
Daniel Kolesa 9f50f08349 eolian: emit correct c_name for keyword builtins 2019-12-02 12:09:50 +01:00
Daniel Kolesa b0ee540ec9 eolian: rename param direction enum and fields for consistency 2019-09-26 16:56:13 +02:00
Daniel Kolesa 6d93dc4cbf eolian: rename event_prefix to event_c_prefix for consistency 2019-09-26 16:47:22 +02:00
Daniel Kolesa 7e10d96d27 eolian: move EOLIAN_TYPE_BUILTIN_HASH into beta section 2019-09-26 16:47:21 +02:00
Daniel Kolesa a95870286e eolian: stricter checks for const() validity 2019-09-26 16:19:12 +02:00
Daniel Kolesa 71cd89c580 eolian: expose most API as stable
There is still some TODO with builtin types, parameter
directions and prefixes, which will be resolved in the
next commits.
2019-09-25 18:26:07 +02:00
Daniel Kolesa 92da64a532 eolian: remove support for globals
This was meant to happen but did not previously happen. It is not
ideal to do it now but better do it while we still can.

In short, this removes one half of the variables API (keeps
constants as they are) and repurposes the API to be only for
constants. This is also better for consistency to match errors.
2019-09-24 18:27:37 +02:00
Daniel Kolesa 539dc642e9 eolian: remove the composite keyword (replaced by composites) 2019-09-19 18:20:56 +02:00
Daniel Kolesa bc793753cb eolian: allow composites keyword in place of composite
Fixes T8218.
2019-09-19 18:20:56 +02:00
Daniel Kolesa 1f19af7780 eolian: disallow void for out/inout for stable API 2019-09-18 21:09:15 +02:00
Daniel Kolesa d9594dbc9d eolian: drop @ctor_param and the associated APIs
This has been unused for a while, and has been just lingering
around the code, so drop it so it doesn't make it into a release.
2019-09-16 15:37:04 +02:00
Xavi Artigas 4c018509c5 eolian: Remove the EOLIAN_PROPERTY_DOC_WARN envvar
This test is now always enabled, so ALL properties should have property-level
documentation. Setter and getter docs are optional.
2019-09-13 12:41:16 +02:00
Daniel Kolesa 3b540fc9f9 eolian: remove @owned keyword 2019-09-06 17:07:01 +02:00
Daniel Kolesa 67c2a4f5f1 eolian: disallow duplicate entries in requires/composite sections 2019-09-06 16:58:49 +02:00
Daniel Kolesa eb25e92770 eolian: change composite syntax from block to inheritance section
This makes more sense as these are related to inheritance tree.
Therefore, change while we still can.

Fixes T8183
2019-09-06 15:14:20 +02:00
Daniel Kolesa 0b6e8f71f1 eolian: move all tests to use the new @move syntax and API 2019-09-02 15:24:14 +02:00
Daniel Kolesa bf58531dba eolian: fix validation of ownability with hashes 2019-08-31 14:11:48 +02:00
Daniel Kolesa 242bad209b eolian: add API to check if an inner type of complex type is @move
This complements the equivalent APIs of parameters and so on.
It is not the same as the older type_is_owned API, which applied
to everything.
2019-08-31 02:13:59 +02:00
Daniel Kolesa fbcad90fec eolian: add parsing for @move and @by_ref
The @by_ref qualifier is now allowed on parameters, returns and
struct fields in the usual qualifier section. It will mean that
this type is passed around by reference, and will only be allowed
on types that are not already pointer-like.

The @move qualifier will replace @owned as one with a clearer
meaning. It means "transfer of ownership". It has the same semantics
as the current @owned, i.e. on return values it transfers ownership
of the value to the caller, on parameters it transfers ownership
to the callee (the inverse is the default when not specified).
On struct fields, it means the field will transfer together with
the struct that contains it.
2019-08-30 16:22:20 +02:00
Daniel Kolesa 9c018613ee eolian: drop @cref
In the end this was just a failed experiment that didn't turn
out to be practical. For now, revert back to ptr(const(T)) until
a proper replacement for pointer syntax is added.
2019-08-29 13:58:16 +02:00
Daniel Kolesa 8a8a833837 eolian: rename @class on methods to @static
Ref https://phab.enlightenment.org/T8118
Ref https://phab.enlightenment.org/T7675
2019-08-16 16:27:00 +02:00
Daniel Kolesa 4f50a9728d eolian: fix false positive use-after-free in parser
The catch here is that check_match results in a long jump under
that condition. The static analyzer doesn't know this, so declare
intent.

CID1402703
2019-08-05 15:42:24 +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 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
Daniel Kolesa 194d769175 eolian: fix unit version check 2019-05-29 21:02:33 +02:00
Daniel Kolesa 21790b055b eolian: prevent parsing when eo file version is too new 2019-05-26 18:30:02 +02:00
Daniel Kolesa db1b637fae eolian: initial versioning implementation
This implements initial support for specifying unit versions.
The default version is 1, specifying the basic feature level.

If you want to specify another version, you need to specify
something like `#version 2` at the beginning of the .eo or
.eot file; the version number must be higher than 0 and lower
than USHRT_MAX (typically 65536).

The beginning of the file is now called the "header section";
other things may be added into the header section later.
Version cannot be specified twice, and it cannot be specified
once other contents (like types or class definition) appear.
Comments do not count as other contents, so those are fine
to appear before #version.

@feature
2019-05-26 18:16:01 +02:00
Daniel Kolesa 13ddc5dbc1 eolian: rename @warn_unused and its associated API
@warn_unused in syntax is now called @no_unused - this is because
"warning about unused" is a C thing (or rather, an extension to C)
and various languages might want to use stricter behavior for this.

Its associated API does the reverse now - it lets you query whether
being unused is allowed at all. This is to match future behavior
of Eolian (once it supports versioning) that will likely reverse it.

@feature
2019-05-26 17:41:22 +02:00
Daniel Kolesa d0fed247bb eolian: remove param @nonull
This has been deprecated for a while and is not strictly necessary
- as a part of an effort to stabilize Eolian, remove this. Eolian
will eventually gain support for versioning and use a reversed
behavior (i.e. no NULL by default), but the API it wlll use for
that will be very different. Features can always be added, it's
much harder to drop them.

@feature
2019-05-26 17:25:15 +02:00
Daniel Kolesa 5ea0195661 eolian: remove @nullable keyword
This was an experiment that never properly took off and was never
used by any generator. Its use was highly variable, so it could
not be relied upon. We will still want to reverse the current
behavior eventually (no null by default), but that will be
done with eo file versioning in the future.

@feature
2019-05-21 16:04:35 +02:00
Daniel Kolesa 4ab1f2388e eolian: add API to retrieve the C name of an object
This is to prepare for type/class renaming support. This adds
the necessary API to retrieve C-specific names. Other refactoring
is necessary elsewhere for now.

This also renames the old API eolian_class_c_name_get to
eolian_class_c_macro_get to avoid conflict as well as clarify
the intention.
2019-05-16 15:43:52 +02:00
Daniel Kolesa 6312cafe20 eolian: move from eo_prefix to c_prefix 2019-05-09 16:17:44 +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
Taehyub Kim b57fd8eb47 eo_parser: fix unreachable code
Summary: fix unreachable code for kw_enum case in parse_unit function

Reviewers: q66, Jaehyun_Cho, woohyun

Reviewed By: q66

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8696
2019-04-24 11:56:32 +02:00
Daniel Kolesa cef2e337b8 eolian: disallow @owned on events
This is never used anywhere and it does not make sense with the
new type rules for events.
2019-03-21 16:17:06 +01:00
Daniel Kolesa 525895f3c4 eolian: remove unused variables 2019-03-08 16:54:10 +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 53a80761db eolian: properly skip the struct keyword in inlist structs
This was missed as a part of an incorrect merge.
2019-02-28 01:08:27 +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
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 dc56376990 eolian: disallow freefuncs on typedefs
Now the only kind of typedecl that is allowed a freefunc is
a struct. This simplifies the overall logic and makes freefuncs
a bit more predictable.
2019-02-17 02:26:22 +01:00
Daniel Kolesa 9674dadbda eolian: restrict usage of ptr() to directly used types
That means, it can only now be used on parameters and struct
fields, never aliased within typedefs. This simplifies the
logic so that we don't have ptr metadata buried several layers
deep.
2019-02-17 02:26:22 +01:00