Discussion:
[E-devel] [EGIT] [core/efl] master 01/01: win: fix compiler warning
Stefan Schmidt
2017-07-13 07:35:31 UTC
Permalink
Hello.
ami pushed a commit to branch master.
http://git.enlightenment.org/core/efl.git/commit/?id=98b9bb0da519c3ac9eb1c33caad79e54349e5a7f
commit 98b9bb0da519c3ac9eb1c33caad79e54349e5a7f
Date: Thu Jul 13 11:16:48 2017 +0900
win: fix compiler warning
---
src/lib/elementary/efl_ui_win.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index 90bdb2c145..cd54c583ca 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -5339,7 +5339,7 @@ _efl_ui_win_elm_widget_focus_manager_factory(Eo *obj EINA_UNUSED, Efl_Ui_Win_Dat
}
EOLIAN static void
-_efl_ui_win_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *pd)
+_efl_ui_win_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *pd EINA_UNUSED)
{
#ifdef HAVE_ELEMENTARY_WL2
if (pd->type == ELM_WIN_FAKE)
As you can see in this line pd is actually used with HAVE_ELEMENTARY_WL2.

regards
Stefan Schmidt
Jean-Philippe André
2017-07-14 02:10:13 UTC
Permalink
Post by Stefan Schmidt
Hello.
ami pushed a commit to branch master.
http://git.enlightenment.org/core/efl.git/commit/?id=98b9bb0
da519c3ac9eb1c33caad79e54349e5a7f
commit 98b9bb0da519c3ac9eb1c33caad79e54349e5a7f
Date: Thu Jul 13 11:16:48 2017 +0900
win: fix compiler warning
---
src/lib/elementary/efl_ui_win.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib/elementary/efl_ui_win.c
b/src/lib/elementary/efl_ui_win.c
index 90bdb2c145..cd54c583ca 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -5339,7 +5339,7 @@ _efl_ui_win_elm_widget_focus_manager_factory(Eo
*obj EINA_UNUSED, Efl_Ui_Win_Dat
}
EOLIAN static void
-_efl_ui_win_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *pd)
+_efl_ui_win_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *pd EINA_UNUSED)
{
#ifdef HAVE_ELEMENTARY_WL2
if (pd->type == ELM_WIN_FAKE)
As you can see in this line pd is actually used with HAVE_ELEMENTARY_WL2.
I think the hint EINA_UNUSED is fine here, as the only other solution is
something like:

#else
(void) pd;
#endif

Which I find uglier. EINA_UNUSED does not change anything in the binary
code.
--
Jean-Philippe André
Stefan Schmidt
2017-07-14 06:54:37 UTC
Permalink
Hello.
Post by Jean-Philippe André
Post by Stefan Schmidt
Hello.
ami pushed a commit to branch master.
http://git.enlightenment.org/core/efl.git/commit/?id=98b9bb0
da519c3ac9eb1c33caad79e54349e5a7f
commit 98b9bb0da519c3ac9eb1c33caad79e54349e5a7f
Date: Thu Jul 13 11:16:48 2017 +0900
win: fix compiler warning
---
src/lib/elementary/efl_ui_win.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib/elementary/efl_ui_win.c
b/src/lib/elementary/efl_ui_win.c
index 90bdb2c145..cd54c583ca 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -5339,7 +5339,7 @@ _efl_ui_win_elm_widget_focus_manager_factory(Eo
*obj EINA_UNUSED, Efl_Ui_Win_Dat
}
EOLIAN static void
-_efl_ui_win_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *pd)
+_efl_ui_win_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data
*pd EINA_UNUSED)
{
#ifdef HAVE_ELEMENTARY_WL2
if (pd->type == ELM_WIN_FAKE)
As you can see in this line pd is actually used with HAVE_ELEMENTARY_WL2.
I think the hint EINA_UNUSED is fine here, as the only other solution is
#else
(void) pd;
#endif
If you think so there will be a lot of code all over efl that can/should
be changed to this. :)
Post by Jean-Philippe André
Which I find uglier. EINA_UNUSED does not change anything in the binary
code.
Are we sure about this even for older compiler versions? GCC and clang?
This is meant as a honest question not rhetoric.

Hmm, having a look at the actual define.

# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
# define EINA_UNUSED __attribute__ ((__unused__))
# else
# define EINA_UNUSED
# endif

So older version would simple tell the warning (if they already have
this implemented). For the __unused__ attribute I see gcc defining it as
this:

unused

This attribute, attached to a variable, means that the variable is
meant to be possibly unused. GCC does not produce a warning for this
variable.

Same text for gcc 3.2 and 7.1 docs. Reading it does indeed sound like
there is no harm at all in using it when the variable is actually used
after all. I always was under the impression this attribute is also used
as a compiler hint to optimize it out. Never checked into the details of
this believe as you can see. :)

I agree that I find the void (foo); method uglier as well, on the other
hand tagging the parameter as unused and still using them in some ifdefs
can also be confusing. Completely ignoring the fact that only gcc and
clang support this attribute and many other compilers will warn about
the unused parameter.

regards
Stefan Schmidt

Loading...