Sha256: 09472384a5887ee9c7ad9eaf826d59cdc0f91016a2ded82da7513abd043c574e

Contents?: true

Size: 1.06 KB

Versions: 5636

Compression:

Stored size: 1.06 KB

Contents

/* Area:		Struct layout
   Purpose:		Test ffi_get_struct_offsets
   Limitations:		none.
   PR:			none.
   Originator: 		Tom Tromey. */

/* { dg-do run } */
#include "ffitest.h"
#include <stddef.h>

struct test_1
{
  char c;
  float f;
  char c2;
  int i;
};

int
main (void)
{
  ffi_type test_1_type;
  ffi_type *test_1_elements[5];
  size_t test_1_offsets[4];

  test_1_elements[0] = &ffi_type_schar;
  test_1_elements[1] = &ffi_type_float;
  test_1_elements[2] = &ffi_type_schar;
  test_1_elements[3] = &ffi_type_sint;
  test_1_elements[4] = NULL;

  test_1_type.size = 0;
  test_1_type.alignment = 0;
  test_1_type.type = FFI_TYPE_STRUCT;
  test_1_type.elements = test_1_elements;

  CHECK (ffi_get_struct_offsets (FFI_DEFAULT_ABI, &test_1_type, test_1_offsets)
	 == FFI_OK);
  CHECK (test_1_type.size == sizeof (struct test_1));
  CHECK (offsetof (struct test_1, c) == test_1_offsets[0]);
  CHECK (offsetof (struct test_1, f) == test_1_offsets[1]);
  CHECK (offsetof (struct test_1, c2) == test_1_offsets[2]);
  CHECK (offsetof (struct test_1, i) == test_1_offsets[3]);

  return 0;
}

Version data entries

5,636 entries across 5,619 versions & 41 rubygems

Version Path
affixapi-1.1.93 vendor/bundle/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
ory-client-1.14.5 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
mux_ruby-3.18.0 vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
ory-client-1.14.4 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
affixapi-1.1.92 vendor/bundle/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
affixapi-1.1.91 vendor/bundle/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
ory-client-1.14.3 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
ory-client-1.14.2 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
affixapi-1.1.90 vendor/bundle/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
ory-kratos-client-1.2.1 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
ory-client-1.14.1 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
ory-client-1.14.0 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
affixapi-1.1.89 vendor/bundle/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
ory-hydra-client-2.2.1 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
ory-oathkeeper-client-0.40.8 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
ory-client-1.13.10 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
ory-client-1.13.6 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
ory-client-1.13.4 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
ory-client-1.13.3 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c
ory-client-1.13.2 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c