From: john s. <sk...@us...> - 2010-11-23 08:52:27
|
I have just written a spec on floating insertion processing. I tried this: header "//C code 1"; module A { header "//C code 2"; fun f: int -> int = "$1"; } println ("Hello" + str (A::f 1)); and it works fine: both 1 and 2 comments are emitted. If I change it to: header "//C code 1"; module A { header "//C code 2"; noinline fun f()=> 1; } println ("Hello" + str (A::f ())); neither are emitted. According to my spec .. this is actually correct! Felix 1.1.5 emitted 1 but not 2 in this case. Requirements are driven by usage of C bindings, if there aren't any C bindings then no header or body insertions can be emitted. At least one tutorial example using cstuct fails for this reason: //test/regress/rt/cstruct_constructors-02.flx header """ struct S { int x; int y; int z; }; """; // cstruct with one element as function cstruct S { x:int; y:int; z:int; } The problem is that "cstruct" isn't recognized as a C binding with requirements: compare: | DCL_abs of type_qual_t list * code_spec_t * named_req_expr_t with | DCL_cstruct of (id_t * typecode_t) list See? No named_req_expr_t. So, there's no where to propagate the dependency on the header, which only gets propagated to C bindings (types, functions, other insertions). This should be easy to fix. It is interesting I got the semantics wrong myself :) I assumed you could *force* code into the output with a naked header, but you can't. -- john skaller sk...@us... |