summaryrefslogtreecommitdiffstatshomepage
path: root/unix/modffi.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-09-06 17:46:52 +0100
committerDamien George <damien.p.george@gmail.com>2014-09-06 17:46:52 +0100
commit17598d49e1091e2745d8f01288f95007189cdcf5 (patch)
tree16b3373dbf2c87498be3914748712b0f9b3cc5ab /unix/modffi.c
parent8002d5d2b986eb551ae3adcb0bd3c31454b63224 (diff)
downloadmicropython-17598d49e1091e2745d8f01288f95007189cdcf5.tar.gz
micropython-17598d49e1091e2745d8f01288f95007189cdcf5.zip
unix: Don't use -Wno-error=cpp or #warning; fix strict alias warning.
For the sake of older versions of gcc (and other compilers), don't use the #warning CPP directive, nor the -Wno-error=cpp option. Also, fix a strict alias warning in modffi.c for older compilers, and add a test for ffi module. Addresses issue #847.
Diffstat (limited to 'unix/modffi.c')
-rw-r--r--unix/modffi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/unix/modffi.c b/unix/modffi.c
index c788f5dd26..e019e9fc95 100644
--- a/unix/modffi.c
+++ b/unix/modffi.c
@@ -146,8 +146,8 @@ STATIC mp_obj_t return_ffi_value(ffi_arg val, char type)
case 'v':
return mp_const_none;
case 'f': {
- float *p = (float*)&val;
- return mp_obj_new_float(*p);
+ union { ffi_arg ffi; float flt; } val_union = { .ffi = val };
+ return mp_obj_new_float(val_union.flt);
}
case 'd': {
double *p = (double*)&val;