-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
I'm trying to resolve Warnings of libc-test for a uclibc-based OS (x86_64-unknown-l4re-uclibc). Currently, I'm facing a more general issue for which I'm not sure how to fix it:
- There is a type alias in the rust files.
Example:
pub type fsword_t = c_long; |
Since this is a "helper type" without pendant in the uclibc, I added this to cfg.skip_type(...)
- There is a struct using this type alias as a field type
Example:
libc/src/unix/linux_like/linux/uclibc/x86_64/mod.rs
Lines 149 to 151 in e021460
pub struct statfs { | |
// FIXME(ulibc) | |
pub f_type: fsword_t, |
- Then we have the problem, that the type alias is not resolved
Example:
warning: [email protected]: .../out/main.c:27500:18: error: unknown type name 'fsword_t';
warning: [email protected]: 27500 | fsword_t* __test_field_type_statfs_f_type(struct statfs* b) {
warning: [email protected]: | ^~~~~~~~
=> Is there any way how to resolve this problem?
I tried adding the resolving of type aliases to ctest2:
- s => (self.opts.type_name)(s, self.structs.contains(s), self.unions.contains(s)),
+ s => {
+ let new_s = (self.opts.type_name)(s, self.structs.contains(s), self.unions.contains(s));
+
+ if self.aliases.contains_key(&new_s) {
+ self.ty2name(self.aliases.get(&new_s).unwrap(), false)
+ } else {
+ new_s.to_string()
+ }
+ }
But this brings up new problems, e.g. that types get resolved that were not meant to be resolved, e.g.
pub type Elf32_Rel = __c_anonymous_elf32_rel;
here's the corresponding warning:
5 warning: [email protected]: .../out/main.c:14500:67: error: invalid application of 'sizeof' to incomplete type 'struct __c_anonymous_elf64_rel'
6 warning: [email protected]: 14500 | uint64_t __test_size_Elf32_Rel(void) { return sizeof(struct __c_anonymous_elf64_rel); }
What do you think? Is...
- resolving the alias the correct move and think about a solution for the followup errors?
- or is there an easy solution for the original problem that does not need changes in ctest2?
Metadata
Metadata
Assignees
Labels
No labels