-
Notifications
You must be signed in to change notification settings - Fork 397
Use a portable isize definition. #1690
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
base: master
Are you sure you want to change the base?
Conversation
This patch removes dependency on platform specific headers.
dtolnay
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have an idea how to preserve this assertion in the cases that ssize_t is available?
Lines 445 to 448 in cd508fc
| static_assert(sizeof(rust::isize) == sizeof(std::intptr_t), | |
| "unsupported ssize_t size"); | |
| static_assert(alignof(rust::isize) == alignof(std::intptr_t), | |
| "unsupported ssize_t alignment"); |
I'm not clear on what you're looking for here. Those assertions are now tautologically true since the type is just an alias. It's not clear to me how the POSIX I'm guessing that the scenarios of concern are APIs where you want a C signature using Now, practically speaking, if what you really do want is to do some assertions about What I think is canonical and best practice here is to use empirical build-time checks about what APIs are available. I'm not very familiar with Rust crates and how things are done there. In builds using autoconf or cmake, it's very common to wire up configure-time checks for whether a particular C/C++ header file is available. (There are also easy canned checking features specifically for types existing IIRC.) In this case, I think it's probably sufficient to just presume that if If you don't mind relying on a feature that wasn't standard in C++ until C++17, or on one that is available only in non-ancient versions of common compilers like GCC and Clang in pre-17 C++ modes, then you could just use |
|
@dtolnay mind taking another look at this and the above comment? |
Remove platform specific headers which were included for ssize_t and use intptr_t instead to prevent failures in baremetal builds.