diff options
| author | Raghuram Subramani <raghus2247@gmail.com> | 2022-06-19 19:47:51 +0530 | 
|---|---|---|
| committer | Raghuram Subramani <raghus2247@gmail.com> | 2022-06-19 19:47:51 +0530 | 
| commit | 4fd287655a72b9aea14cdac715ad5b90ed082ed2 (patch) | |
| tree | 65d393bc0e699dd12d05b29ba568e04cea666207 /circuitpython/lib/libffi/testsuite/libffi.go/aa-direct.c | |
| parent | 0150f70ce9c39e9e6dd878766c0620c85e47bed0 (diff) | |
add circuitpython code
Diffstat (limited to 'circuitpython/lib/libffi/testsuite/libffi.go/aa-direct.c')
| -rw-r--r-- | circuitpython/lib/libffi/testsuite/libffi.go/aa-direct.c | 34 | 
1 files changed, 34 insertions, 0 deletions
| diff --git a/circuitpython/lib/libffi/testsuite/libffi.go/aa-direct.c b/circuitpython/lib/libffi/testsuite/libffi.go/aa-direct.c new file mode 100644 index 0000000..b00c404 --- /dev/null +++ b/circuitpython/lib/libffi/testsuite/libffi.go/aa-direct.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ + +#include "static-chain.h" + +#if defined(__GNUC__) && !defined(__clang__) && defined(STATIC_CHAIN_REG) + +#include "ffitest.h" + +/* Blatent assumption here that the prologue doesn't clobber the +   static chain for trivial functions.  If this is not true, don't +   define STATIC_CHAIN_REG, and we'll test what we can via other tests.  */ +void *doit(void) +{ +  register void *chain __asm__(STATIC_CHAIN_REG); +  return chain; +} + +int main() +{ +  ffi_cif cif; +  void *result; + +  CHECK(ffi_prep_cif(&cif, ABI_NUM, 0, &ffi_type_pointer, NULL) == FFI_OK); + +  ffi_call_go(&cif, FFI_FN(doit), &result, NULL, &result); + +  CHECK(result == &result); + +  return 0; +} + +#else /* UNSUPPORTED */ +int main() { return 0; } +#endif | 
