linux下编译增加gcc选项-c -O2 -Wall 编译失败,这问题有解?
In file included from /usr/include/python2.7/Python.h:80:0,
from ffpython.h:4,
from example.cpp:6:
ffpython.h: In member function ‘int ffpython_t::init_pyclass(PyObject_)’:
/usr/include/python2.7/object.h:767:22: warning: dereferencing type-punned pointer will break strict-aliasing rules -Wstrict-aliasing->ob_refcnt++)
^
ffpython.h:1274:13: note: in expansion of macro ‘Py_INCREF’
Py_INCREF(&m_all_pyclass[i].pytype_def);
^
ffpython.h: In static member function ‘static PyObject_ pytype_traits_t::pyobj_from_cppobj(bool)’:
/usr/include/python2.7/object.h:767:22: warning: dereferencing type-punned pointer will break strict-aliasing rules -Wstrict-aliasing->ob_refcnt++)
^
/usr/include/python2.7/boolobject.h:27:31: note: in expansion of macro ‘Py_INCREF’
#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
^
ffpython.h:1705:13: note: in expansion of macro ‘Py_RETURN_TRUE’
Py_RETURN_TRUE;
^
/usr/include/python2.7/object.h:767:22: warning: dereferencing type-punned pointer will break strict-aliasing rules -Wstrict-aliasing->ob_refcnt++)
^
/usr/include/python2.7/boolobject.h:28:32: note: in expansion of macro ‘Py_INCREF’
#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
^
ffpython.h:1707:9: note: in expansion of macro ‘Py_RETURN_FALSE’
Py_RETURN_FALSE;
^
In file included from example.cpp:6:0:
ffpython.h: In member function ‘pyext_tool_t& pyext_tool_t::parse_arg(T&)’:
ffpython.h:2213:56: warning: typedef ‘value_t’ locally defined but not used [-Wunused-local-typedefs]
typedef typename type_ref_traits_t::value_t value_t;
^
example.cpp: In function ‘void test_cpp_obj_py_obj(ffpython_t&)’:
example.cpp:140:12: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
foo_t* p = ffpython.call<foo_t*>("fftest", "test_cpp_obj_py_obj", &tmp_foo);
^
In file included from /usr/include/python2.7/Python.h:87:0,
from ffpython.h:4,
from example.cpp:6:
ffpython.h: In instantiation of ‘static PyObject* pyclass_base_info_t::release(PyTypeObject_, PyObject_) [with T = foo_t; PyObject = object; PyTypeObject = typeobject]’:
ffpython.h:700:25: required from ‘pyclass_regigster_tool_t& ffpython_t::reg_class(const string&, std::string, std::string) [with T = foo_t; CTOR = int ()(int); std::string = std::basic_string]’
example.cpp:106:48: required from here
/usr/include/python2.7/boolobject.h:24:46: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
#define Py_True ((PyObject *) &Py_TrueStruct)
^
/usr/include/python2.7/boolobject.h:27:51: note: in expansion of macro ‘Py_True’
#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
^
ffpython.h:433:17: note: in expansion of macro ‘Py_RETURN_TRUE’
Py_RETURN_TRUE;
^
ffpython.h: In instantiation of ‘static PyObject pyclass_base_info_t::release(PyTypeObject, PyObject_) [with T = dumy_t; PyObject = object; PyTypeObject = typeobject]’:
ffpython.h:700:25: required from ‘pyclass_regigster_tool_t& ffpython_t::reg_class(const string&, std::string, std::string) [with T = dumy_t; CTOR = int ()(int); std::string = std::basic_string]’
example.cpp:112:103: required from here
/usr/include/python2.7/boolobject.h:24:46: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
#define Py_True ((PyObject ) &Py_TrueStruct)
^
/usr/include/python2.7/boolobject.h:27:51: note: in expansion of macro ‘Py_True’
#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
^
ffpython.h:433:17: note: in expansion of macro ‘Py_RETURN_TRUE’
Py_RETURN_TRUE;
^
In file included from example.cpp:6:0:
ffpython.h: In static member function ‘static PyObject pyext_func_traits_t<RET ()(ARG1, ARG2, ARG3, ARG4)>::pyfunc(PyObject, PyObject_) [with RET = int; ARG1 = int; ARG2 = float; ARG3 = const std::basic_string&; ARG4 = const std::vector&; PyObject = object]’:
ffpython.h:2287:94: warning: ‘a2’ may be used uninitialized in this function [-Wmaybe-uninitialized]
return pytype_traits_t::pyobj_from_cppobj(f(a1.value, a2.value, a3.value, a4.value));
^
ffpython.h:2667:33: note: ‘a2’ was declared here
type_ref_traits_t a2;
^
In file included from /usr/include/string.h:640:0,
from /usr/include/python2.7/Python.h:38,
from ffpython.h:4,
from example.cpp:6:
In function ‘void* memcpy(void, const void_, size_t)’,
inlined from ‘pyclass_regigster_tool_t& pyclass_regigster_tool_t::reg(FUNC, const string&, std::string) [with FUNC = int (foo_t::)()const; std::string = std::basic_string]’ at ffpython.h:542:9,
inlined from ‘void test_register_base_class(ffpython_t&)’ at example.cpp:107:39:
/usr/include/x86_64-linux-gnu/bits/string3.h:51:71: warning: call to void builtin___memcpy_chk(void, const void, long unsigned int, long unsigned int) will always overflow destination buffer [enabled by default]
return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (dest));
^
In function ‘void* memcpy(void, const void, size_t)’,
inlined from ‘pyclass_regigster_tool_t& pyclass_regigster_tool_t::reg(FUNC, const string&, std::string) [with FUNC = void (foo_t::)(int); std::string = std::basic_string]’ at ffpython.h:542:9,
inlined from ‘void test_register_base_class(ffpython_t&)’ at example.cpp:108:39:
/usr/include/x86_64-linux-gnu/bits/string3.h:51:71: warning: call to void builtin___memcpy_chk(void, const void, long unsigned int, long unsigned int) will always overflow destination buffer [enabled by default]
return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (dest));
^
In function ‘void* memcpy(void, const void, size_t)’,
inlined from ‘pyclass_regigster_tool_t& pyclass_regigster_tool_t::reg(FUNC, const string&, std::string) [with FUNC = void (foo_t::)(std::mapstd::basic_string<char, std::list >&); std::string = std::basic_string]’ at ffpython.h:542:9,
inlined from ‘void test_register_base_class(ffpython_t&)’ at example.cpp:109:37:
/usr/include/x86_64-linux-gnu/bits/string3.h:51:71: warning: call to void builtin___memcpy_chk(void, const void, long unsigned int, long unsigned int) will always overflow destination buffer [enabled by default]
return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (dest));
^
In function ‘void* memcpy(void, const void, size_t)’,
inlined from ‘pyclass_regigster_tool_t& pyclass_regigster_tool_t::reg(FUNC, const string&, std::string) [with FUNC = void (dumy_t::)(); std::string = std::basic_string]’ at ffpython.h:542:9,
inlined from ‘void test_register_base_class(ffpython_t&)’ at example.cpp:113:36:
/usr/include/x86_64-linux-gnu/bits/string3.h:51:71: warning: call to void builtin___memcpy_chk(void, const void, long unsigned int, long unsigned int) will always overflow destination buffer [enabled by default]
return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));