Note: I found a bug in c-stack-cdecl which codes not permit such
native functions to be used as values. I added an xfail-test
(c-stack-as-value) documenting it.
In the main test, I call the wrapper instead of the native fn, as intended.
I also added an xfail-test that exercises the broken code path. Will
file a bug.
Description of the broken code path:
The code path is that when we look up the external identifier we go through
trans_external_path() -> type_of_ty_param_kinds_and_ty() ->
type_of_fn_from_ty() -> type_of_fn(), and type_of_fn() adds a lot of external
parameters. Problem is, I guess, that we don't pass the native ABI (or even the
fact that it's a native function!), just the types and kinds of the parameters.
there is one test failure, stdtest/sys.rs, which inexplicably
(thus far) fails to compile because it invokes
sys::rustrt::last_os_error() instead of invoking
sys::last_os_error(). If stdtest/sys.rs is updated to invoke
the wrapper, it passes. Still tracing the source of this error.
On my machine I have two LLVM builds, one of regular HEAD and one
for Rust in ~/rust-llvm - by default CFG_LLVM_CONFIG is set to
/usr/local/bin/llvm-config which is wrong, because the probe for it
initially happens earlier in configure and succeeds (so putvar is called.)
This causes it to be emitted twice into the Makefile but the second
instance wins.
currently trans_c_stack_native_call() had some ad-hoc code for
determining the type of the arguments. this code was not in
agreement with the rest of trans. now it uses the same code path.
Previously, the parser would try to interpret this as a block call:
if true {} // No semicolon
{|i, am, a, block|};
Which, though unlikely, might come up in practice.
This makes it possible to omit the semicolon after the block, and will
cause the pretty-printer to properly print such calls (if
pretty-printing of blocks wasn't so broken). Block calls (with the
block outside of the parentheses) can now only occur at statement
level, and their value can not be used. When calling a block-style
function that returns a useful value, the block must be put insde the
parentheses.
Issue #1054