summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2013-07-20 02:52:04 (GMT)
committerRaymond Hettinger <python@rcn.com>2013-07-20 02:52:04 (GMT)
commit5ea0f80165109e7a144e6e3780a17dcd63dfae47 (patch)
treee4eedd75dcc54cc6449441babe8e3c5bc615dff5 /Modules
parent520ad5791670e356787b947baeb6885320cb6237 (diff)
downloadcpython-5ea0f80165109e7a144e6e3780a17dcd63dfae47.zip
cpython-5ea0f80165109e7a144e6e3780a17dcd63dfae47.tar.gz
cpython-5ea0f80165109e7a144e6e3780a17dcd63dfae47.tar.bz2
Make the GCC-4.8 compiler happy by moving declarations to the top of the function.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/libffi_osx/ffi.c11
-rw-r--r--Modules/_ctypes/libffi_osx/x86/x86-ffi64.c11
2 files changed, 13 insertions, 9 deletions
diff --git a/Modules/_ctypes/libffi_osx/ffi.c b/Modules/_ctypes/libffi_osx/ffi.c
index bf42093..96826b5 100644
--- a/Modules/_ctypes/libffi_osx/ffi.c
+++ b/Modules/_ctypes/libffi_osx/ffi.c
@@ -38,12 +38,13 @@ initialize_aggregate(
/*@out@*/ ffi_type* arg)
{
/*@-usedef@*/
+ ffi_type** ptr;
if (arg == NULL || arg->elements == NULL ||
arg->size != 0 || arg->alignment != 0)
return FFI_BAD_TYPEDEF;
- ffi_type** ptr = &(arg->elements[0]);
+ ptr = &(arg->elements[0]);
while ((*ptr) != NULL)
{
@@ -135,16 +136,16 @@ ffi_prep_cif(
/*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype,
/*@dependent@*/ ffi_type** atypes)
{
+ unsigned int bytes = 0;
+ unsigned int i;
+ ffi_type** ptr;
+
if (cif == NULL)
return FFI_BAD_TYPEDEF;
if (abi <= FFI_FIRST_ABI || abi > FFI_DEFAULT_ABI)
return FFI_BAD_ABI;
- unsigned int bytes = 0;
- unsigned int i;
- ffi_type** ptr;
-
cif->abi = abi;
cif->arg_types = atypes;
cif->nargs = nargs;
diff --git a/Modules/_ctypes/libffi_osx/x86/x86-ffi64.c b/Modules/_ctypes/libffi_osx/x86/x86-ffi64.c
index 06feaf2..9839833 100644
--- a/Modules/_ctypes/libffi_osx/x86/x86-ffi64.c
+++ b/Modules/_ctypes/libffi_osx/x86/x86-ffi64.c
@@ -225,14 +225,16 @@ classify_argument(
/* Merge the fields of structure. */
for (ptr = type->elements; *ptr != NULL; ptr++)
{
+ int num, pos;
+
byte_offset = ALIGN(byte_offset, (*ptr)->alignment);
- int num = classify_argument(*ptr, subclasses, byte_offset % 8);
+ num = classify_argument(*ptr, subclasses, byte_offset % 8);
if (num == 0)
return 0;
- int pos = byte_offset / 8;
+ pos = byte_offset / 8;
for (i = 0; i < num; i++)
{
@@ -589,11 +591,12 @@ ffi_prep_closure(
void (*fun)(ffi_cif*, void*, void**, void*),
void* user_data)
{
+ volatile unsigned short* tramp;
+
if (cif->abi != FFI_UNIX64)
return FFI_BAD_ABI;
- volatile unsigned short* tramp =
- (volatile unsigned short*)&closure->tramp[0];
+ tramp = (volatile unsigned short*)&closure->tramp[0];
tramp[0] = 0xbb49; /* mov <code>, %r11 */
*(void* volatile*)&tramp[1] = ffi_closure_unix64;