aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/libffi/src/prep_cif.c
diff options
context:
space:
mode:
authorMikhail Borisov <borisov.mikhail@gmail.com>2022-02-10 16:45:40 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:40 +0300
commit5d50718e66d9c037dc587a0211110b7d25a66185 (patch)
treee98df59de24d2ef7c77baed9f41e4875a2fef972 /contrib/restricted/libffi/src/prep_cif.c
parenta6a92afe03e02795227d2641b49819b687f088f8 (diff)
downloadydb-5d50718e66d9c037dc587a0211110b7d25a66185.tar.gz
Restoring authorship annotation for Mikhail Borisov <borisov.mikhail@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'contrib/restricted/libffi/src/prep_cif.c')
-rw-r--r--contrib/restricted/libffi/src/prep_cif.c110
1 files changed, 55 insertions, 55 deletions
diff --git a/contrib/restricted/libffi/src/prep_cif.c b/contrib/restricted/libffi/src/prep_cif.c
index 0aece251b9..06c6544036 100644
--- a/contrib/restricted/libffi/src/prep_cif.c
+++ b/contrib/restricted/libffi/src/prep_cif.c
@@ -29,12 +29,12 @@
/* Round up to FFI_SIZEOF_ARG. */
-#define STACK_ARG_SIZE(x) FFI_ALIGN(x, FFI_SIZEOF_ARG)
+#define STACK_ARG_SIZE(x) FFI_ALIGN(x, FFI_SIZEOF_ARG)
/* Perform machine independent initialization of aggregate type
specifications. */
-static ffi_status initialize_aggregate(ffi_type *arg, size_t *offsets)
+static ffi_status initialize_aggregate(ffi_type *arg, size_t *offsets)
{
ffi_type **ptr;
@@ -52,15 +52,15 @@ static ffi_status initialize_aggregate(ffi_type *arg, size_t *offsets)
while ((*ptr) != NULL)
{
if (UNLIKELY(((*ptr)->size == 0)
- && (initialize_aggregate((*ptr), NULL) != FFI_OK)))
+ && (initialize_aggregate((*ptr), NULL) != FFI_OK)))
return FFI_BAD_TYPEDEF;
/* Perform a sanity check on the argument type */
FFI_ASSERT_VALID_TYPE(*ptr);
- arg->size = FFI_ALIGN(arg->size, (*ptr)->alignment);
- if (offsets)
- *offsets++ = arg->size;
+ arg->size = FFI_ALIGN(arg->size, (*ptr)->alignment);
+ if (offsets)
+ *offsets++ = arg->size;
arg->size += (*ptr)->size;
arg->alignment = (arg->alignment > (*ptr)->alignment) ?
@@ -76,15 +76,15 @@ static ffi_status initialize_aggregate(ffi_type *arg, size_t *offsets)
struct A { long a; char b; }; struct B { struct A x; char y; };
should find y at an offset of 2*sizeof(long) and result in a
total size of 3*sizeof(long). */
- arg->size = FFI_ALIGN (arg->size, arg->alignment);
-
- /* On some targets, the ABI defines that structures have an additional
- alignment beyond the "natural" one based on their elements. */
-#ifdef FFI_AGGREGATE_ALIGNMENT
- if (FFI_AGGREGATE_ALIGNMENT > arg->alignment)
- arg->alignment = FFI_AGGREGATE_ALIGNMENT;
-#endif
-
+ arg->size = FFI_ALIGN (arg->size, arg->alignment);
+
+ /* On some targets, the ABI defines that structures have an additional
+ alignment beyond the "natural" one based on their elements. */
+#ifdef FFI_AGGREGATE_ALIGNMENT
+ if (FFI_AGGREGATE_ALIGNMENT > arg->alignment)
+ arg->alignment = FFI_AGGREGATE_ALIGNMENT;
+#endif
+
if (arg->size == 0)
return FFI_BAD_TYPEDEF;
else
@@ -129,27 +129,27 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi,
cif->rtype = rtype;
cif->flags = 0;
-#ifdef _M_ARM64
- cif->is_variadic = isvariadic;
-#endif
-#if HAVE_LONG_DOUBLE_VARIANT
- ffi_prep_types (abi);
-#endif
+#ifdef _M_ARM64
+ cif->is_variadic = isvariadic;
+#endif
+#if HAVE_LONG_DOUBLE_VARIANT
+ ffi_prep_types (abi);
+#endif
/* Initialize the return type if necessary */
- if ((cif->rtype->size == 0)
- && (initialize_aggregate(cif->rtype, NULL) != FFI_OK))
+ if ((cif->rtype->size == 0)
+ && (initialize_aggregate(cif->rtype, NULL) != FFI_OK))
return FFI_BAD_TYPEDEF;
-#ifndef FFI_TARGET_HAS_COMPLEX_TYPE
- if (rtype->type == FFI_TYPE_COMPLEX)
- abort();
-#endif
+#ifndef FFI_TARGET_HAS_COMPLEX_TYPE
+ if (rtype->type == FFI_TYPE_COMPLEX)
+ abort();
+#endif
/* Perform a sanity check on the return type */
FFI_ASSERT_VALID_TYPE(cif->rtype);
/* x86, x86-64 and s390 stack space allocation is handled in prep_machdep. */
-#if !defined FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION
+#if !defined FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION
/* Make space for the return structure pointer */
if (cif->rtype->type == FFI_TYPE_STRUCT
#ifdef TILE
@@ -158,9 +158,9 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi,
#ifdef XTENSA
&& (cif->rtype->size > 16)
#endif
-#ifdef NIOS2
- && (cif->rtype->size > 8)
-#endif
+#ifdef NIOS2
+ && (cif->rtype->size > 8)
+#endif
)
bytes = STACK_ARG_SIZE(sizeof(void*));
#endif
@@ -169,23 +169,23 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi,
{
/* Initialize any uninitialized aggregate type definitions */
- if (((*ptr)->size == 0)
- && (initialize_aggregate((*ptr), NULL) != FFI_OK))
+ if (((*ptr)->size == 0)
+ && (initialize_aggregate((*ptr), NULL) != FFI_OK))
return FFI_BAD_TYPEDEF;
-#ifndef FFI_TARGET_HAS_COMPLEX_TYPE
- if ((*ptr)->type == FFI_TYPE_COMPLEX)
- abort();
-#endif
+#ifndef FFI_TARGET_HAS_COMPLEX_TYPE
+ if ((*ptr)->type == FFI_TYPE_COMPLEX)
+ abort();
+#endif
/* Perform a sanity check on the argument type, do this
check after the initialization. */
FFI_ASSERT_VALID_TYPE(*ptr);
-#if !defined FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION
+#if !defined FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION
{
/* Add any padding if necessary */
if (((*ptr)->alignment - 1) & bytes)
- bytes = (unsigned)FFI_ALIGN(bytes, (*ptr)->alignment);
+ bytes = (unsigned)FFI_ALIGN(bytes, (*ptr)->alignment);
#ifdef TILE
if (bytes < 10 * FFI_SIZEOF_ARG &&
@@ -201,7 +201,7 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi,
bytes = 6*4;
#endif
- bytes += (unsigned int)STACK_ARG_SIZE((*ptr)->size);
+ bytes += (unsigned int)STACK_ARG_SIZE((*ptr)->size);
}
#endif
}
@@ -246,18 +246,18 @@ ffi_prep_closure (ffi_closure* closure,
}
#endif
-
-ffi_status
-ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type, size_t *offsets)
-{
- if (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI))
- return FFI_BAD_ABI;
- if (struct_type->type != FFI_TYPE_STRUCT)
- return FFI_BAD_TYPEDEF;
-
-#if HAVE_LONG_DOUBLE_VARIANT
- ffi_prep_types (abi);
-#endif
-
- return initialize_aggregate(struct_type, offsets);
-}
+
+ffi_status
+ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type, size_t *offsets)
+{
+ if (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI))
+ return FFI_BAD_ABI;
+ if (struct_type->type != FFI_TYPE_STRUCT)
+ return FFI_BAD_TYPEDEF;
+
+#if HAVE_LONG_DOUBLE_VARIANT
+ ffi_prep_types (abi);
+#endif
+
+ return initialize_aggregate(struct_type, offsets);
+}