Commit Graph

99 Commits

Author SHA1 Message Date
Lauro Moura f3199ba04b eolian-cxx: Release iterators
Summary:
When the iterators advanced, the CXX wrappers null'd them but did not
call eina_value_free.

ref T8280

Reviewers: q66, brunobelo, felipealmeida

Reviewed By: q66

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8280

Differential Revision: https://phab.enlightenment.org/D10238
2019-09-30 16:08:24 +02:00
Lauro Moura 03da60997e cxx: Fix some warnings from -Wextra
Summary:
- As we don't have C++17's [[fallthrough]], rely on GCC'd detection
  of fallthrough comments.

  See https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/

- Replaced some copy constructors with typecast operators.

  Previously, a constructor with remove_const/remove_cv were used
  to allow const iterators to be constructed from non-const iterators.
  This had the side effect of making these constructors actual copy
  constructors for non const lists. As we did not define other
  special constructors/operators, the rule of 5 were violated for these
  cases.

  This commit replaces these constructors with actual typecast operators
  that promote non const iterators to their const counterparts.

- Cast a Eina_Bool/bool narrowing conversion

- Add a missing break statement from D10050

Reviewers: zmike, brunobelo, felipealmeida

Reviewed By: brunobelo

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9934
2019-09-23 13:58:01 -03:00
Mike Blumenkrantz 9dc7643f93 Revert "cxx: Fix some warnings from -Wextra"
This reverts commit bdb8505f3b.

more review pending on this
2019-09-16 14:19:43 -04:00
Lauro Moura bdb8505f3b cxx: Fix some warnings from -Wextra
Summary:
- As we don't have C++17's [[fallthrough]], rely on GCC'd detection
  of fallthrough comments.

See https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/

- Add some missing copy assignment operators as reported by
  -Wdeprecated-copy

- Cast a Eina_Bool/bool narrowing conversion

Reviewers: zmike, brunobelo, felipealmeida

Reviewed By: zmike

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9934
2019-09-16 12:41:37 -04:00
Felipe Magno de Almeida dccd68491c eolian-cxx: Generate eot files
Summary:
Eolian Type files were not being generated, which made some template
specialization to not be defined, for example for function_wrappers.

Reviewers: bu5hm4n, woohyun, lauromoura

Reviewed By: lauromoura

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9468
2019-07-31 18:38:02 -03:00
Vitor Sousa f331d1c6cc cxx: remove a compilation warning for g++ 7.x
Remove a compilation warning about an unsupported warning category for g++ 7.x.

A `#pragma` directive was used to suppress a `-Wcast-function-type` warning
in g++.
Versions older than 8.x do not have this warning category and raises a warning
because of this directive.

Now this directive is only enabled for g++ version 8.x or newer.
2019-07-17 19:32:32 -03:00
Vitor Sousa b1e44484a5 cxx: remove compilation warnings in C++ code, from both gcc and clang
Summary:
Remove almost all the compilation warnings from C++ code. Only explicit
warnings using the `#warning` preprocessor directive remain.

Some warnings had to be suppressed with `#pragma` directives because the
behavior they were warning about is intended in some specific places.
Code comments were added in such situations.

Added a generator that creates `#pragma` directives in order to suppress
warnings in all generated C++ headers.
Currently `-Wignored-qualifiers` is the only warning category being suppressed.
The innocuous const qualifiers that it points are inoffensive and have
no effect in compilation at all.
They are also hard to track in generation since they can emerge from different
types in many places.

To ease the generation of the warning suppressors an utility constructor was
added to `efl::eolian::grammar::attributes::unused_type`.

Add constructors to `eolian_mono::class_context` to default initialize its
internal string and avoid field initialization warnings.

Test Plan: `meson test`

Reviewers: lauromoura, felipealmeida, zmike, segfaultxavi

Reviewed By: zmike

Subscribers: cedric, #reviewers, #committers

Tags: #efl_language_bindings

Differential Revision: https://phab.enlightenment.org/D9275
2019-07-12 09:07:27 -04:00
Lauro Moura e38fc2264c cxx: Rename Elementary.hh into Efl_Ui.hh
Also include Efl_Ui.h alongside Elementary.h (the latter is still needed
by some widgets).
2019-05-02 21:00:57 +02:00
Marcel Hollerbach e881f936e8 meson: unbreak cxx header installation
Summary:
before we had *correct* fileds in the subdir: keyword. However,
install_dir: was wrong, so *this* time, this seems right.

Reviewers: cedric, zmike, segfaultxavi, raster

Reviewed By: zmike

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8634
2019-04-18 12:30:22 -04:00
Lauro Moura cacbd9e58d cxx: Fix eldbus meta include name
Summary:
It should not conflict with Eldbus_Model header

Fixes T7805

Reviewers: vtorri

Reviewed By: vtorri

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7805

Differential Revision: https://phab.enlightenment.org/D8611
2019-04-15 19:20:10 -03:00
Marcel Hollerbach d293f0ef9f meson: fix subdir in the installation
we did a completly wrong thing here, and it only worked by accident.
We passed a absolut path into a parameter where only a number should be
passed. This is now fixed.

This fixes meson build with meson-0.50 and bindings enabled

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8328
2019-03-14 11:06:56 +01:00
Felipe Magno de Almeida f392c5a436 efl-mono: Add support for dotnet core
Summary:
This commits adds dotnet as a supported C# platform for EFL# bindings.

Due to differences between Mono and Dotnet regarding DllImport, the
bindings now are using an imperative approach to load the function
pointers through the NativeModule and FunctionWrapper classes. These
classes handle the dlopen/LoadLibrary and dlsym/GetProcAddress calls.

Also, the previous caching of non-owned strings returned to native code
was removed until further memory checks.

We also had to create workaround for bool and chars in Structs for C#
marshaling. Going through System.Byte instead and Marshaling manually
to their respective types.

In order to actually build efl_mono.dll with dotnet right now,
issue #4782 from Meson should be fixed to make it properly detect and
used the Dotnet compiler. Also use "-Ddotnet=true" when running meson.

Fixes T7394

Reviewers: felipealmeida, vitor.sousa, bu5hm4n

Reviewed By: vitor.sousa

Subscribers: cedric

Tags: #efl

Maniphest Tasks: T7394

Differential Revision: https://phab.enlightenment.org/D8069
2019-03-01 23:58:56 -03:00
Felipe Magno de Almeida 36286a23fe efl-cxx: Fix compilation error when using a ptr to const any_value
Reviewers: lauromoura, cedric

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7858
2019-02-01 10:51:19 +00:00
Lauro Moura 5f1b448323 eo: Replace ptr(Eina.Strbuf) with plain strbuf.
Summary: Also fix CXX compilation after this change.

Reviewers: cedric, felipealmeida

Reviewed By: felipealmeida

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7792
2019-01-28 16:15:09 +09:00
Cedric BAIL 40ca3fbe58 eina_cxx: allow for the generation of function that return Eina_Promise in .eo files.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D7576
2019-01-16 14:33:24 -08:00
Marcel Hollerbach e36e8d9321 meson-cxx: ecore must be build after efl 2019-01-02 12:43:36 +01:00
Carsten Haitzler 91990b7cf8 meson - fix pc file versions that were missing mirco version 2018-12-27 11:54:30 +00:00
Marcel Hollerbach 4a4d32b60d build: make bindings cross compileable
Differential Revision: https://phab.enlightenment.org/D7470
2018-12-17 17:43:08 +01:00
Marcel Hollerbach e85311c992 meson: here comes cxx bindings
this commits is bringing cxx bindings.
You can enable / disable them with the cxx option.

Differential Revision: https://phab.enlightenment.org/D7181
2018-10-24 12:05:58 +02:00
Marcel Hollerbach 52e0b8440b Revert "meson: add cxx bindings"
This reverts commit 5aaf2cbb5d.

The cxx bindings were accidently merged. Things are missing (like .eot.h
files)
2018-10-18 16:12:13 +02:00
Marcel Hollerbach 5aaf2cbb5d meson: add cxx bindings
this commit adds cxx bindings to meson.

Differential Revision: https://phab.enlightenment.org/D7169
2018-10-18 16:01:07 +02:00
Lauro Moura 946b47430d eina_cxx: Fix eina::value copy constructor.
Summary:
The previous declaration was causing the implicit copy constructor to be
invoked when copying a new eina::value from an existing eina::value,
thus leading to two wrappers pointing to the same underlying C pointer.

This showed some error messages when running the tests but under autotools
it didn't fail, while building with meson caused it to segfault.

Reviewers: vitor.sousa

Reviewed By: vitor.sousa

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7166
2018-10-16 18:47:20 -03:00
Lauro Moura f1fddf5c74 cxx: Remove libeolian_cxx dependency on eo_cxx
Summary: Fixes T7324

Reviewers: felipealmeida, bu5hm4n, zmike

Reviewed By: felipealmeida, bu5hm4n, zmike

Subscribers: segfaultxavi, cedric, #reviewers, #committers, zmike

Tags: #efl

Maniphest Tasks: T7324

Differential Revision: https://phab.enlightenment.org/D6881
2018-08-21 14:21:43 -04:00
Lauro Moura 7d4c5f5d7c eo_cxx: Fix do_eo_add after lifecycle branch.
Summary:
Also changed the previously failing tests to use ck_assert_int_eqinstead
of fail_if for better reporting.

Test Plan: make check

Reviewers: cedric, felipealmeida

Reviewed By: cedric

Subscribers: #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6194

Reviewed-by: Cedric BAIL <cedric@osg.samsung.com>
2018-05-25 10:00:42 -07:00
Lauro Moura 473d5b79c5 efl_cxx: remove eolized promises from the CXX bindings
Summary:
Also added a blacklist header to temporarily disable generation of eo
methods with futures as arguments or return type.

Once the models branch lands, we should enable future support again with
eina_futures.

Reviewers: cedric

Reviewed By: cedric

Differential Revision: https://phab.enlightenment.org/D6018
2018-05-01 10:39:01 -07:00
Felipe Magno de Almeida 92f5383e3c efl-cxx: Fix using efl_add_ref instead of efl_add 2018-04-03 17:28:07 -03:00
Carsten Haitzler 1c74aaa7e9 Revert "cxx: Fix manual code after efl_app change."
This reverts commit 135154303b.

Revert "efl: move signal events from efl.loop to efl.app"
This reverts commit 3dbca39f98.

Revert "efl: add test suite for efl_app"
This reverts commit 3e94be5d73.

Revert "efl: create Efl.App class, the parent of Efl.Loop"
This reverts commit 28fe00b94e.

Go back to before efl.app because I think this should be done with
superclassing here not a parent object. reasons?

1. multiple loops per single thread make no sense. so if multilpe loop
objects they wont be contained in a single app object and then deleted
like this.
2. the app object is not really sharable in this design so it cant be
accessed from other threads
3. it makes it harder to get the main loop or app object (well 2 func
calls one calling the other and more typing. it is longer to type and
more work where it is not necessary, and again it can't work from
other threads unless we go duplicating efl.app per thread and then
what is the point of splittyign out the signal events from efl.loop
then?)

etc.
2018-03-03 13:40:33 +09:00
Lauro Moura 135154303b cxx: Fix manual code after efl_app change.
Test Plan: Run make check

Reviewers: felipealmeida

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D5827
2018-02-26 21:14:09 -03:00
Carsten Haitzler 9bedda14b3 efl loop - rename ecore_main_loop_get to efl_main_loop_get
ecore_main_loop_get() is really a new "eo api" but it's using our old
ecore_* namespace, so move to the new efl namespace.
2018-01-02 16:13:54 +09:00
Jean-Philippe Andre 207a0cf3e3 eo: Move hacky API auto_unref to C only
This API is meant to be used by parts only, and by bindings dealing with
part objects. This patch fixes make check which got broken in the after
the previous one (cxx).
2017-12-05 15:06:34 +09:00
Jean-Philippe Andre 725026a4ba cxx: Fix one conversion to Eina_Value 2017-12-05 15:01:45 +09:00
Jean-Philippe Andre c9322dd561 cxx: Add global _delete() method to all objects
This is really just calling efl_del() and detaching the internal pointer
from the C++ object. This will not affect other references, which means
after del the object may still be alive, probably without a parent.
2017-12-05 15:01:45 +09:00
Jean-Philippe Andre 09cf282741 cxx: Use per-function guards in efl object
This prevents generation of del().
I also removed constructor, finalize and destructor as I believe this
requires special work with eo_inherit (where did this work go??).
2017-12-05 15:01:45 +09:00
Jean-Philippe Andre 9d14b4cfe8 cxx: Give ref to returned objects
This should give a ref to obj in the following scenario:

  auto obj = other.function();

Where obj is an eo object.
2017-12-05 10:17:02 +09:00
Jean-Philippe Andre 753304c69d cxx: Add define EFL_CXXPERIMENTAL for testing
I'll hide some controversial features behind this, until we come to an
agreement with @felipealmeida and people who actually know C++ (iow: not
just me^^).

Features protected:
 - easy wref (using -> without locking)
 - xxx_event_cb_add() functions in object classes
 - instantiate(obj) to create a new object
 - add as a synonym for instantiate (both in efl::eo)
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre 5425baa906 cxx: Add support for function pointers
This was tested on the function pointer Efl.Ui.Format_Func_Cb
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre 488c29febd cxx: Add FIXME note in eina_value.hh
I think some concepts are not handled properly in this set of classes.
I'll do some more experiments to see if I can find a working solution,
but I think we need 3 variants of eina_value, instead of just the two
provided.
2017-12-05 10:09:58 +09:00
Jean-Philippe Andre cfb3365060 cxx: Add strbuf support
Comes in two fashions:
 - strbuf_view (read-only)
 - strbuf (read/write)
2017-12-05 10:09:58 +09:00
Jean-Philippe Andre db8227a34a cxx: Add alternative form to instantiate object
This still uses the instantiate object but provides a more convenient
syntax for objects declared before their creation (eg. a global win).

Note: I wonder if we shouldn't rename instantiate to add. It would be
closer to EFL API's while being much much easier to type.
2017-12-05 10:09:58 +09:00
Jean-Philippe Andre 289a4e3aaa cxx: Only give a single ref to unparented objects
On instantiation objects get either one or two refs:
 - with a parent, they will have 2 refs, one for C++, one for the
   parent.
 - without a parent, they get a single ref, the one for C++

This will break the existing C++ examples, which I will fix in later
patches.

Note that the window is a strange object which can be created with no
parent but internally reparents itself to an object it creates (oh so
ugly).
2017-11-14 12:18:39 +09:00
Andy Williams d5dbcdabd1 eo: Rename efl_ref_get to efl_ref_count 2017-11-08 09:30:42 +00:00
Jean-Philippe Andre 58527a3dbb cxx: Fix log color in eina_log.hh
Changed from invalid "black" to arbitrary choice of green.
2017-11-07 09:57:24 +09:00
Jean-Philippe Andre 64698daeb5 cxx: Add support for operator == with objects 2017-11-07 09:57:24 +09:00
Jean-Philippe Andre e7009b77a2 cxx: Add experimental "easy" way to use wref
I hid it behind ifdef for now as I'm very much unsure of what I'm doing.
This whole modern C++ thing is still weird to me :)

Prerequisite:
 #define EFL_CXX_WREF_EASY

This allows constructs such as:

  auto wobj = obj._get_wref();
  std::cout << wobj->text_get() << std::endl;
2017-11-07 09:57:24 +09:00
Jean-Philippe Andre 88e10da36b cxx: Mark wref::lock as const
This allows passing in wref to a lambda.
If we passed normal refs, we would end up with dangling references and
many ERR messages.
2017-11-07 09:57:24 +09:00
Jean-Philippe Andre 8c991b104c cxx: Add nullptr constructor for weak refs
This allows constructs such as:

  wref_obj = obj;
  ...
  wref_obj = nullptr;
2017-11-07 09:57:24 +09:00
Jean-Philippe Andre 03b22c4d7b cxx: Instantiate objects with 2 refs
This is the original meaning of efl_add_ref().
Somehow the "ref" bool was set to true in the first call, and false in
the second call.
2017-11-07 09:57:24 +09:00
Felipe Magno de Almeida de349e1b9e eo-cxx: Fix compilation error with any_value received by value 2017-10-30 21:05:39 -02:00
Felipe Magno de Almeida 96d3af10bf eolian-cxx: Add optional parameter to lambda for unnamed proxy instantiation 2017-09-28 17:50:14 -03:00
Felipe Magno de Almeida bb887f9869 eolian-cxx: Fix compilation errors with new any_value_ptr and mstring types 2017-09-25 21:57:25 -03:00