Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of warnings when compiling #5

Closed
porglezomp opened this issue Oct 4, 2014 · 8 comments
Closed

Lots of warnings when compiling #5

porglezomp opened this issue Oct 4, 2014 · 8 comments

Comments

@porglezomp
Copy link
Contributor

There are 82 warnings when compiling.

@porglezomp
Copy link
Contributor Author

It looks like almost every single one can be resolved by setting the structs to #[repr(C)], is there any reason not to do this?

It looks like what it primarily does is tell the compiler that it's going to be used by foreign functions, do you know if there are any downsides?

@kornelski
Copy link
Owner

Good idea. Done.

@porglezomp
Copy link
Contributor Author

You missed the it on

pub struct Error(pub c_uint);

When I add it there, there are no more warnings at all.

@kornelski
Copy link
Owner

Odd, I'm not getting any warnings in rustc 0.12.0-pre-nightly (85fd37f87). The error "struct" is Rust-private, so it shouldn't have repr(C).

@porglezomp
Copy link
Contributor Author

I'm using rustc 0.13.0-nightly (b6e0d3a5b 2014-10-16 09:12:17 +0000), so perhaps that's the problem. It does seem odd, perhaps we found a regression?

Nonetheless, I'm getting

/Users/caleb/Development/lodepng-rust/src/lib.rs:196:41: 196:46 warning: found type without foreign-function-safe
                                      representation annotation in foreign module, consider adding a #[repr(...)] attribute to the type, #[warn(improper_ctypes)] on by default
/Users/caleb/Development/lodepng-rust/src/lib.rs:196         pub fn lodepng_error_text(code: Error) -> &'static i8;
                                                                                             ^~~~~

In addition to a lot more ones, all pointing at the Error struct.

@kornelski
Copy link
Owner

Ah, I forgot it's passed to lodepng_error_text. I guess the compiler is smarter than me ;)

@porglezomp
Copy link
Contributor Author

It is also complaining about all the return values, but it might be complaining only because of that one.

@kornelski
Copy link
Owner

I've upgraded rustc, and with one more tweak dda3c78 it builds cleanly for me.

@0xcpu 0xcpu mentioned this issue Mar 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants