classification
Title: Got warning when compiling ffi.c on Mac
Type: Stage: resolved
Components: macOS Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: matrixise, ned.deily, python-dev, ronaldoussoren, vajrasky, vstinner, zach.ware
Priority: normal Keywords: patch

Created on 2015-06-04 14:44 by vajrasky, last changed 2016-10-20 19:46 by ned.deily. This issue is now closed.

Files
File name Uploaded Description Edit
fix_ffi_compile_warning.patch vajrasky, 2015-06-04 14:44 review
Messages (9)
msg244825 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2015-06-04 14:44
On my OS X Yosemite 10.10.3, I got this warning when compiling Modules/_ctypes/libffi_osx/ffi.c.

gcc -Wno-unused-result -Wsign-compare -g -O0 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -I_ctypes/darwin -I/Users/sky/Code/python/cpython/Modules/_ctypes/libffi_osx/include -I/Users/sky/Code/python/cpython/Modules/_ctypes/libffi_osx/powerpc -I./Include -I. -IInclude -I/usr/local/include -I/Users/sky/Code/python/cpython/Include -I/Users/sky/Code/python/cpython -c /Users/sky/Code/python/cpython/Modules/_ctypes/libffi_osx/ffi.c -o build/temp.macosx-10.9-x86_64-3.6-pydebug/Users/sky/Code/python/cpython/Modules/_ctypes/libffi_osx/ffi.o -DMACOSX
/Users/sky/Code/python/cpython/Modules/_ctypes/libffi_osx/ffi.c:108:1: warning: unused function 'struct_on_stack' [-Wunused-function]
struct_on_stack(
^
1 warning generated.

Here is the patch that I think can fix the warning.
msg278559 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2016-10-13 11:29
I have reviewed the patch, the first "#if defined" was not complete.
msg278939 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-10-18 21:29
Modules/_ctypes/libffi_osx/ffi.c comes from libffi, can you please propose a bugfix upstream?

* https://sourceware.org/libffi/
* https://github.com/libffi/libffi

I'm not sure where is the upstream.
msg278940 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2016-10-18 21:37
of course, I will do it. Thank for your review
msg279048 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2016-10-20 16:52
@victor

There are two issues.

1. The bundled version of CFFI is just outdated
2. There is an issue for the removal of libffi_osx (http://bugs.python.org/issue27979)

so, we can fix the bundled libcffi or close this issue.
msg279049 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2016-10-20 16:57
Correction: #27979 is unrelated to Modules/_ctypes/libffi_osx.  A hypothetical (at this point) removal of libffi_osx will be a separate issue.  I think it's probably worthwhile to fix this issue.
msg279055 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2016-10-20 17:22
@zach.ware so in this case, we could merge the patch in 3.6 & 3.7.
msg279071 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-10-20 19:44
New changeset 2b089035a453 by Ned Deily in branch '3.5':
Issue #24381: Avoid unused function warning when building bundled macOS libffi.
https://hg.python.org/cpython/rev/2b089035a453

New changeset c60d41590054 by Ned Deily in branch '3.6':
Issue #24381: merge from 3.5
https://hg.python.org/cpython/rev/c60d41590054

New changeset 59838bede1de by Ned Deily in branch 'default':
Issue #24381: merge from 3.6
https://hg.python.org/cpython/rev/59838bede1de

New changeset cca20d28f348 by Ned Deily in branch '2.7':
Issue #24381: Avoid unused function warning when building bundled macOS libffi.
https://hg.python.org/cpython/rev/cca20d28f348
msg279072 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-10-20 19:46
Thank you for the patch!  Now fixed in the bundled versions of libffi for OS X.
History
Date User Action Args
2016-10-20 19:46:10ned.deilysetstatus: open -> closed
versions: + Python 2.7, Python 3.7
messages: + msg279072

resolution: fixed
stage: commit review -> resolved
2016-10-20 19:44:02python-devsetnosy: + python-dev
messages: + msg279071
2016-10-20 17:22:03matrixisesetmessages: + msg279055
2016-10-20 16:57:15zach.waresetnosy: + zach.ware
messages: + msg279049
2016-10-20 16:52:47matrixisesetmessages: + msg279048
2016-10-18 21:37:20matrixisesetmessages: + msg278940
2016-10-18 21:29:29vstinnersetnosy: + vstinner
messages: + msg278939
2016-10-13 11:29:20matrixisesetnosy: + matrixise
messages: + msg278559
2016-10-13 11:09:37matrixisesetstage: commit review
2015-06-04 14:44:05vajraskycreate