Hello!

I found that eet loader from imlib2-loaders-1.7.1 fails to build
(with gcc-10.2.0 and efl-1.25.1, full build log is attached):

loader_eet.c:384:5: error: invalid use of incomplete typedef 
�~@~XImlibLoader�~@~Y {aka �~@~Xstruct _imlibloader�~@~Y}
  384 |    l->num_formats = sizeof(list_formats) / sizeof(char *);
      |     ^~
This happens because struct _imlibloader (aka typedef ImlibLoader)
is not defined within imlib2_loaders sources. As I see imlib2_loaders
copies private headers from imlib2, so the solution is to add and
include missing loaders.h header, see attached patch.

Best regards,
Andrew Savchenko
Fix eet loader build failure

loader_eet.c references ImageLoader (struct _imageloader) fields,
but struct definition is not available. This leads to the following
build failure when package is configured with --enable-eet:

libtool: compile:  x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../../.. -I/usr/include/eet-1 -I/usr/include/eina-1 -I/usr/include/eina-1/eina -I/usr/include/emile-1 -I/usr/include/efl-1 -I/usr/include/efl-1/interfaces -I/usr/include/eo-1 -pthread -W -Wall -Wcast-align -Wpointer-arith -Wshadow -Wwrite-strings -Wno-unused-parameter -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -fvisibility=hidden -march=native -O3 -pipe -frecord-gcc-switches -c loader_eet.c  -fPIC -DPIC -o .libs/eet_la-loader_eet.o
loader_eet.c:9: warning: "SWAP32" redefined
    9 | #define SWAP32(x) (x) = \
      |
In file included from loader_common.h:5,
                 from loader_eet.c:7:
common.h:19: note: this is the location of the previous definition
   19 | #define SWAP32(x) \
      |
loader_eet.c: In function �~@~Xsave�~@~Y:
loader_eet.c:244:60: warning: parameter �~@~Xprogress_granularity�~@~Y set but not used [-Wunused-but-set-parameter]
  244 | save(ImlibImage * im, ImlibProgressFunction progress, char progress_granularity)
      |                                                       ~~~~~^~~~~~~~~~~~~~~~~~~~
loader_eet.c: In function �~@~Xformats�~@~Y:
loader_eet.c:384:5: error: invalid use of incomplete typedef �~@~XImlibLoader�~@~Y {aka �~@~Xstruct _imlibloader�~@~Y}
  384 |    l->num_formats = sizeof(list_formats) / sizeof(char *);
      |     ^~
loader_eet.c:385:5: error: invalid use of incomplete typedef �~@~XImlibLoader�~@~Y {aka �~@~Xstruct _imlibloader�~@~Y}
  385 |    l->formats = malloc(sizeof(char *) * l->num_formats);
      |     ^~
loader_eet.c:385:42: error: invalid use of incomplete typedef �~@~XImlibLoader�~@~Y {aka �~@~Xstruct _imlibloader�~@~Y}
  385 |    l->formats = malloc(sizeof(char *) * l->num_formats);
      |                                          ^~
loader_eet.c:387:21: error: invalid use of incomplete typedef �~@~XImlibLoader�~@~Y {aka �~@~Xstruct _imlibloader�~@~Y}
  387 |    for (i = 0; i < l->num_formats; i++)
      |                     ^~
loader_eet.c:388:8: error: invalid use of incomplete typedef �~@~XImlibLoader�~@~Y {aka �~@~Xstruct _imlibloader�~@~Y}
  388 |       l->formats[i] = strdup(list_formats[i]);
      |        ^~
make[4]: *** [Makefile:502: eet_la-loader_eet.lo] Error 1

In order to fix this loaders.h header is added from imlib2-1.7.1 and
is included in loader_common.h.

Signed-off-by: Andrew Savchenko <[email protected]>
---
 src/modules/loaders/loader_common.h |  1 +
 src/modules/loaders/loaders.h       | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
 create mode 100644 src/modules/loaders/loaders.h

diff --git a/src/modules/loaders/loader_common.h b/src/modules/loaders/loader_common.h
index d1716c9..534cc5f 100644
--- a/src/modules/loaders/loader_common.h
+++ b/src/modules/loaders/loader_common.h
@@ -4,6 +4,7 @@
 #include "config.h"
 #include "common.h"
 #include "image.h"
+#include "loaders.h"
 
 __EXPORT__ char     load(ImlibImage * im, ImlibProgressFunction progress,
                          char progress_granularity, char load_data);
diff --git a/src/modules/loaders/loaders.h b/src/modules/loaders/loaders.h
new file mode 100644
index 0000000..1f31799
--- /dev/null
+++ b/src/modules/loaders/loaders.h
@@ -0,0 +1,21 @@
+#ifndef __LOADERS
+#define __LOADERS 1
+
+#include "image.h"
+
+struct _imlibloader {
+   char               *file;
+   int                 num_formats;
+   char              **formats;
+   void               *handle;
+   char                (*load)(ImlibImage * im,
+                               ImlibProgressFunction progress,
+                               char progress_granularity, char load_data);
+   char                (*save)(ImlibImage * im,
+                               ImlibProgressFunction progress,
+                               char progress_granularity);
+   ImlibLoader        *next;
+   int                 (*load2)(ImlibImage * im, int load_data);
+};
+
+#endif /* __LOADERS */
-- 
2.24.0

Attachment: imlib2_loaders-1.7.1:20210116-110514.log.xz
Description: application/xz

Attachment: pgpNVk3ZpA7dv.pgp
Description: PGP signature

_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to