Sha256: efca20df5614c011e4d099ee9a713caa285073bf95571f7e84a0d8a9839f5b6e

Contents?: true

Size: 987 Bytes

Versions: 4069

Compression:

Stored size: 987 Bytes

Contents

/* Area:	ffi_call
   Purpose:	Check strlen function call with additional arguments.
   Limitations:	none.
   PR:		none.
   Originator:	From the original ffitest.c  */

/* { dg-do run } */

#include "ffitest.h"

static size_t ABI_ATTR my_f(char *s, float a)
{
  return (size_t) ((int) strlen(s) + (int) a);
}

int main (void)
{
  ffi_cif cif;
  ffi_type *args[MAX_ARGS];
  void *values[MAX_ARGS];
  ffi_arg rint;
  char *s;
  float v2;
  args[0] = &ffi_type_pointer;
  args[1] = &ffi_type_float;
  values[0] = (void*) &s;
  values[1] = (void*) &v2;
  
  /* Initialize the cif */
  CHECK(ffi_prep_cif(&cif, ABI_NUM, 2,
		       &ffi_type_sint, args) == FFI_OK);
  
  s = "a";
  v2 = 0.0;
  ffi_call(&cif, FFI_FN(my_f), &rint, values);
  CHECK(rint == 1);
  
  s = "1234567";
  v2 = -1.0;
  ffi_call(&cif, FFI_FN(my_f), &rint, values);
  CHECK(rint == 6);
  
  s = "1234567890123456789012345";
  v2 = 1.0;
  ffi_call(&cif, FFI_FN(my_f), &rint, values);
  CHECK(rint == 26);
  
  exit(0);
}

Version data entries

4,069 entries across 4,052 versions & 39 rubygems

Version Path
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/ffi-1.11.1/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/ffi-1.11.1/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/ffi-1.11.1/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
dadapush_client-1.0.1 vendor/bundle/ruby/2.3.0/gems/ffi-1.9.25/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/ffi-1.11.1/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/ffi-1.11.1/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
ffi-1.11.1 ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
tdiary-5.0.13 vendor/bundle/gems/ffi-1.10.0/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
approveapi-1.0.8 vendor/bundle/ruby/2.6.0/gems/ffi-1.10.0/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
tdiary-5.0.12.1 vendor/bundle/gems/ffi-1.10.0/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.10.0/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/gems/ffi-1.10.0/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
approveapi-1.0.5 vendor/bundle/ruby/2.6.0/gems/ffi-1.10.0/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/ffi-1.9.25/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/ffi-1.9.25/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.10.0/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c
ffi-1.10.0 ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c