Skip to content

Test failures on Gentoo. #63

@NHOrus

Description

@NHOrus

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions