everyone--
Maybe I'm missing it, but I don't see how to apply parameter attributes to function return types in either the C-language or OCaml bindings. Can anybody help clue me in? Thanks.
everyone--
Maybe I'm missing it, but I don't see how to apply parameter attributes to function return types in either the C-language or OCaml bindings. Can anybody help clue me in? Thanks.
I hope I can assume from the lack of response to my question that the answer is No, I'm not missing anything: the functionality is missing from both the C-language and OCaml bindings. Should I also assume that this is an oversight and that a patch would be welcome?
I'll respond.
What is it you want? You say "parameter attributes", but a return type isn't a parameter (as far as I know). And I don't believe that C allows you to specify an attribute on a return type itself.
Let's hypothesize, though. If you want to apply an attribute to a type, then you may do so in the GCC way with the __attribute__(()) syntax:
struct A {
int f[3];
} __attribute__((aligned(8)));
or:
typedef int foo __attribute__((aligned(13)));
and then use that in with your functions:
foo func() {
foo f = 37;
/* ... */
return f;
}
If that's what you want, then we will place the attribute on the type itself (assuming it's an attribute we support and haven't forgotten to implement, etc.).
-bw
Maybe I'm missing it, but I don't see how to apply parameter attributes to function return types in either the C-language or OCaml bindings. Can anybody help clue me in? Thanks.
I hope I can assume from the lack of response to my question that the answer is No, I'm not missing anything: the functionality is missing from both the C-language and OCaml bindings. Should I also assume that this is an oversight and that a patch would be welcome?
I'll respond.
What is it you want? You say "parameter attributes", but a return type isn't a parameter (as far as I know). And I don't believe that C allows you to specify an attribute on a return type itself.
Let's hypothesize, though. If you want to apply an attribute to a type, then you may do so in the GCC way with the __attribute__(()) syntax:
struct A {
int f[3];
} __attribute__((aligned(8)));or:
typedef int foo __attribute__((aligned(13)));
and then use that in with your functions:
foo func() {
foo f = 37;
/* ... */
return f;
}If that's what you want, then we will place the attribute on the type itself (assuming it's an attribute we support and haven't forgotten to implement, etc.).
No, that's not what he wants.
You misunderstand. Given a function represented in LLVM IR:
declare i32 @foo(i32 @a, i32 @b)
he wants to be able to programmatically add an LLVM attribute to the
return type of the function from the C bindings or the OCaml bindings.
From the looks of it, there doesn't seem to be any way to do this right
now. You can add attributes to the function itself, and to its
parameters, but not to its return type.
Chip