Skip to content

Conversation

@jcarrano
Copy link

@jcarrano jcarrano commented Oct 22, 2018

Description

This change fixes some C++ warnings on the file generated by Cython. Additionally, it sets the Python version to 3 in the pyx file.

Build output

Before

cythoning bfd/bfd.pyx to bfd/bfd.cpp
/home/jcarrano/source/python-bfd/.eggs/Cython-0.29-py3.7-linux-x86_64.egg/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/jcarrano/source/python-bfd/bfd/bfd.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
warning: bfd/bfd.pyx:48:8: 'stdout' redeclared 
building 'bfd' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/bfd
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fstack-protector-strong -fno-plt -flto=4 -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -march=x86-64 -mtune=generic -O3 -pipe -fstack-protector-strong -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fstack-protector-strong -fno-plt -fPIC -DMAJOR_VERSION=1 -DMINOR_VERSION=0 -DPACKAGE=1 -DPACKAGE_VERSION=1 -I/usr/include/python3.7m -c bfd/bfd.cpp -o build/temp.linux-x86_64-3.7/bfd/bfd.o -fpermissive
bfd/bfd.cpp: In function ‘PyObject* __pyx_pf_3bfd_list_architectures(PyObject*)’:
bfd/bfd.cpp:2565:28: warning: invalid conversion from ‘const char**’ to ‘char**’ [-fpermissive]
   __pyx_v_a = bfd_arch_list();
               ~~~~~~~~~~~~~^~
bfd/bfd.cpp: In function ‘PyObject* __pyx_pf_3bfd_2list_targets(PyObject*)’:
bfd/bfd.cpp:2714:30: warning: invalid conversion from ‘const char**’ to ‘char**’ [-fpermissive]
   __pyx_v_t = bfd_target_list();
               ~~~~~~~~~~~~~~~^~
bfd/bfd.cpp: In function ‘int __pyx_pf_3bfd_3Bfd___cinit__(__pyx_obj_3bfd_Bfd*, PyObject*, PyObject*, PyObject*)’:
bfd/bfd.cpp:6534:47: warning: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
   __pyx_v_self->arch = bfd_printable_arch_mach(__pyx_v_self->archId, __pyx_v_self->mach);
                        ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bfd/bfd.cpp: In function ‘PyObject* __pyx_f_3bfd_3Bfd__load_sections(__pyx_obj_3bfd_Bfd*)’:
bfd/bfd.cpp:7337:46: warning: invalid conversion from ‘void*’ to ‘void (*)(bfd*, asection*, void*)’ {aka ‘void (*)(bfd*, bfd_section*, void*)’} [-fpermissive]
   bfd_map_over_sections(__pyx_v_self->abfd, ((void *)__pyx_f_3bfd_add_sections_callback), ((PyObject *)__pyx_v_self));
                                             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from bfd/bfd.cpp:629:
/usr/include/bfd.h:1906:12: note:   initializing argument 2 of ‘void bfd_map_over_sections(bfd*, void (*)(bfd*, asection*, void*), void*)’
     void (*func) (bfd *abfd, asection *sect, void *obj),
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bfd/bfd.cpp: In function ‘PyObject* __pyx_pf_3bfd_3Bfd_8disassemble(__pyx_obj_3bfd_Bfd*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*)’:
bfd/bfd.cpp:8107:23: warning: invalid conversion from ‘const bfd_target*’ to ‘bfd_target*’ [-fpermissive]
   __pyx_v_xvec_orig = __pyx_t_6;
                       ^~~~~~~~~

After

cythoning bfd/bfd.pyx to bfd/bfd.cpp
warning: bfd/bfd.pyx:49:8: 'stdout' redeclared `

Explicitly set the Python version to 3.
Fix pointer casts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant