Skip to content

add fmemopen, open_memstream, and open_wmemstream for POSIX.1-2008 #1855

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

Merged
merged 1 commit into from
Aug 20, 2020

Conversation

jedbrown
Copy link
Contributor

@jedbrown jedbrown commented Aug 7, 2020

This is useful for interfacing with C libraries that can write output to FILE objects, for example.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @JohnTitor (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@JohnTitor
Copy link
Member

CI says:

  cargo:warning=/checkout/target/aarch64-linux-android/debug/build/libc-test-a9ad6fe1596a08f5/out/main.c:4439:24: error: use of undeclared identifier 'fmemopen'; did you mean 'freopen'?
  cargo:warning=                return fmemopen;
  cargo:warning=                       ^~~~~~~~
  cargo:warning=                       freopen
  cargo:warning=/android/ndk-aarch64/bin/../sysroot/usr/include/stdio.h:286:7: note: 'freopen' declared here
  cargo:warning=FILE* freopen(const char* __path, const char* __mode, FILE* __fp);
  cargo:warning=      ^
  cargo:warning=/checkout/target/aarch64-linux-android/debug/build/libc-test-a9ad6fe1596a08f5/out/main.c:4439:24: error: incompatible pointer types returning 'FILE *(const char *, const char *, FILE *)' (aka 'struct __sFILE *(const char *, const char *, struct __sFILE *)') from a function with result type 'FILE *(*)(void *, size_t, const char *)' (aka 'struct __sFILE *(*)(void *, unsigned long, const char *)') [-Werror,-Wincompatible-pointer-types]
  cargo:warning=                return fmemopen;
  cargo:warning=                       ^~~~~~~~
  cargo:warning=/checkout/target/aarch64-linux-android/debug/build/libc-test-a9ad6fe1596a08f5/out/main.c:4444:24: error: use of undeclared identifier 'open_memstream'
  cargo:warning=                return open_memstream;
  cargo:warning=                       ^
  cargo:warning=/checkout/target/aarch64-linux-android/debug/build/libc-test-a9ad6fe1596a08f5/out/main.c:4449:24: error: use of undeclared identifier 'open_wmemstream'
  cargo:warning=                return open_wmemstream;
  cargo:warning=                       ^
  cargo:warning=4 errors generated.
  exit code: 1

but I think the aarch64 env already has them, doesn't it?

@jedbrown
Copy link
Contributor Author

I tried to model off other POSIX.1-2008 functions and I don't understand why it would be missing only on aarch64. What's the procedure for fixing this?

@JohnTitor
Copy link
Member

I tried to model off other POSIX.1-2008 functions and I don't understand why it would be missing only on aarch64. What's the procedure for fixing this?

If it isn't missing, we can skip the tests for them in libc-test/build.rs.

@JohnTitor
Copy link
Member

And I think it's related to #1765, it'd be great if you also could add a FIXME comment(s) with this issue number.

@JohnTitor
Copy link
Member

@jedbrown Friendly-ping, we're going to a new release. If you're still interested, I'm happy to wait for a while until this gets merged :)

@jedbrown
Copy link
Contributor Author

@JohnTitor Thanks for the ping. I've added it to the skip list for aarch64. Did you also want a comment in src/unix/mod.rs next to these functions? I don't see it for the other cases listed in libc-test/build.rs.

Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you also want a comment in src/unix/mod.rs next to these functions? I don't see it for the other cases listed in libc-test/build.rs.

No, this makes sense now. Thanks!

@JohnTitor JohnTitor merged commit 8dd5137 into rust-lang:master Aug 20, 2020
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

Successfully merging this pull request may close these issues.

3 participants