ctypes.sh icon indicating copy to clipboard operation
ctypes.sh copied to clipboard

Test failures on Gentoo.

Open NHOrus opened this issue 10 months ago • 6 comments

I am trying to update package of ctypes.sh for Gentoo, because current one fails tests, and in the process future-proof it a bit. Build of ctypes.sh fails with GCC-14 and GCC-15 with error:

struct/struct.c: In function 'create_array_stealer':
struct/struct.c:416:74: error: passing argument 4 of 'cu__find_struct_by_name' from incompatible pointer type [-Wincompatible-pointer-types]
  416 |         if (!(tag = cu__find_struct_by_name(cu, cookie->typename, false, &class_id)))
      |                                                                          ^~~~~~~~~
      |                                                                          |
      |                                                                          uint16_t * {aka short unsigned int *}
In file included from struct/struct.c:11:
struct/dwarves.h:366:73: note: expected 'type_id_t *' {aka 'unsigned int *'} but argument is of type 'uint16_t *' {aka 'short unsigned int *'}
  366 |                                     const int include_decls, type_id_t *id);
      |                                                              ~~~~~~~~~~~^~
struct/struct.c: In function 'find_sizeof_stealer':
struct/struct.c:443:74: error: passing argument 4 of 'cu__find_struct_by_name' from incompatible pointer type [-Wincompatible-pointer-types]
  443 |         if (!(tag = cu__find_struct_by_name(cu, cookie->typename, false, &class_id)))
      |                                                                          ^~~~~~~~~
      |                                                                          |
      |                                                                          uint16_t * {aka short unsigned int *}
struct/dwarves.h:366:73: note: expected 'type_id_t *' {aka 'unsigned int *'} but argument is of type 'uint16_t *' {aka 'short unsigned int *'}
  366 |                                     const int include_decls, type_id_t *id);
      |                                                              ~~~~~~~~~~~^~

I made a patch for it:

--- ctypes-sh-1.2.old/src/struct/struct.c       2025-02-22 10:13:35.145982185 +0400
+++ ctypes-sh-1.2/src/struct/struct.c   2025-02-22 10:16:26.936573138 +0400
@@ -402,7 +402,7 @@
 // search it to see if it contains something we're interested in.
 static enum load_steal_kind create_array_stealer(struct cu *cu, struct conf_load *conf_load)
 {
-    static uint16_t class_id;
+    static type_id_t class_id;
     struct tag *tag;
     struct cookie *cookie = conf_load->cookie;
     char *path;
@@ -430,7 +430,7 @@
 // search it to see if it contains something we're interested in.
 static enum load_steal_kind find_sizeof_stealer(struct cu *cu, struct conf_load *conf_load)
 {
-    static uint16_t class_id;
+    static type_id_t class_id;
     struct tag *tag;
     struct cookie *cookie = conf_load->cookie;
 

but I am not confident that this patch is correct - in all the other places class_id is uint16_t Please advise.

NHOrus avatar Feb 22 '25 06:02 NHOrus