This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] libffi prep_cif.c move FFI_ASSERT_VALID_TYPE
- From: Andreas Tobler <toa at pop dot agri dot ch>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 26 Oct 2003 12:26:52 +0100
- Subject: [patch] libffi prep_cif.c move FFI_ASSERT_VALID_TYPE
Hello,
while investigating the pyobjc-tc.c I came to prep_cif.c:
It could be that we have some uninitialized types, therefore we do the
initialization. But it doesn't make sense to check the validity of the
type before we did the initialization, or?
We could probably leave this check anyway since we do it in
initialize_aggregate.
Is this ok for mainline?
Andreas
2003-10-26 Andreas Tobler <a.tobler@schweiz.ch>
* src/prep_cif.c (ffi_prep_cif): Move the validity check after
the initialization.
RCS file: /cvs/gcc/gcc/libffi/src/prep_cif.c,v
retrieving revision 1.7
diff -u -r1.7 prep_cif.c
--- prep_cif.c 21 Oct 2003 19:01:54 -0000 1.7
+++ prep_cif.c 26 Oct 2003 11:23:41 -0000
@@ -125,12 +125,14 @@
for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
{
- /* Perform a sanity check on the argument type */
- FFI_ASSERT_VALID_TYPE(*ptr);
/* Initialize any uninitialized aggregate type definitions */
if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK))
return FFI_BAD_TYPEDEF;
+
+ /* Perform a sanity check on the argument type, do this
+ check after the initialization. */
+ FFI_ASSERT_VALID_TYPE(*ptr);
#if !defined __x86_64__ && !defined S390
#ifdef SPARC