Closed fotonick closed 5 years ago
First of all, thank you for the PR, and for the detailed description!
I'm very happy to add clang support, even if partial. There are a couple of nits that I'd like to see fixed before merging, though, I'll comment on them inline. But otherwise nice job.
I'm also okay with defaulting to clang on macos (AIUI, clang comes with XCode, but GCC has to be installed manually). By the way, does gcc -E
work on MacOS instead of cpp
?
I'm not so sure about limiting library to linux and macos. Besides windows, there are various other operating systems that Rust supports, and at least the various BSD variants would have either gcc or clang. I don't know what is the best course of action here yet, but at the very least I'd leave cpp as a fallback.
Thanks for the comments. They seem like strict improvements. Will get to them in the next day or so. MacOS does make the gcc
alias by default, so gcc -E
could have broad applicability. Maybe broader than cpp
?
I don't know if Github notifies you about file updates. Regardless, it's worth saying that I've taken a stab at addressing all of your comments, so it's worth reevaluating whenever you're ready.
Looks good, thank you!
I wanted to try your library on a Mac, but was stymied by two issues:
cpp
is broken on macOS in that it's both stuck in K&R mode and has a bug surrounding its handling of indented preprocessor directives. Ref: Stack Overflow. To this end:clang -E
whentarget_os = macos
.target_os
is notlinux
ormacos
, I throw a compile error. Thus Windows is explicitly not yet supported (this project's only open issue).SyntaxError
. In the case ofstdio.h
, it's because it uses a new type qualifier_Nullable
, which is not defined elsewhere. It turns out that it's a Clang extension. To address this, I added some Clang support:strings.rs
.Flavor::Clang11
and reworked theEnv
initialization to make "core" C11 a subset of gnu11 and gnu11 a subset of Clang11.Env
option.I hope you'll consider taking these patches. I'm very open to feedback, particularly as I'm somewhat new to Rust.