diff --git a/src/Base/swigpyrun_1.3.25.cpp b/src/Base/swigpyrun_1.3.25.cpp index ee8a748b01..3e6d07d5bd 100644 --- a/src/Base/swigpyrun_1.3.25.cpp +++ b/src/Base/swigpyrun_1.3.25.cpp @@ -28,6 +28,11 @@ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wdeprecated-register" # pragma clang diagnostic ignored "-Wself-assign" +#elif defined (__GNUC__) +# pragma GCC diagnostic push +# if __GNUC__ >= 8 +# pragma GCC diagnostic ignored "-Wcast-function-type" +# endif #endif namespace Swig_1_3_25 { #include "swigpyrun_1.3.25.h" @@ -35,5 +40,7 @@ namespace Swig_1_3_25 { } #if defined(__clang__) # pragma clang diagnostic pop +#elif defined (__GNUC__) +# pragma GCC diagnostic pop #endif diff --git a/src/Base/swigpyrun_1.3.33.cpp b/src/Base/swigpyrun_1.3.33.cpp index 0b1821239a..21a94f9ac3 100644 --- a/src/Base/swigpyrun_1.3.33.cpp +++ b/src/Base/swigpyrun_1.3.33.cpp @@ -28,6 +28,11 @@ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wdeprecated-register" # pragma clang diagnostic ignored "-Wself-assign" +#elif defined (__GNUC__) +# pragma GCC diagnostic push +# if __GNUC__ >= 8 +# pragma GCC diagnostic ignored "-Wcast-function-type" +# endif #endif namespace Swig_1_3_33 { #define SWIG_PYTHON_NO_BUILD_NONE @@ -36,5 +41,7 @@ namespace Swig_1_3_33 { } #if defined(__clang__) # pragma clang diagnostic pop +#elif defined (__GNUC__) +# pragma GCC diagnostic pop #endif diff --git a/src/Base/swigpyrun_1.3.36.cpp b/src/Base/swigpyrun_1.3.36.cpp index 2267a1c646..b4374c3b97 100644 --- a/src/Base/swigpyrun_1.3.36.cpp +++ b/src/Base/swigpyrun_1.3.36.cpp @@ -28,6 +28,11 @@ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wdeprecated-register" # pragma clang diagnostic ignored "-Wself-assign" +#elif defined (__GNUC__) +# pragma GCC diagnostic push +# if __GNUC__ >= 8 +# pragma GCC diagnostic ignored "-Wcast-function-type" +# endif #endif namespace Swig_1_3_36 { #define SWIG_PYTHON_NO_BUILD_NONE @@ -36,5 +41,7 @@ namespace Swig_1_3_36 { } #if defined(__clang__) # pragma clang diagnostic pop +#elif defined (__GNUC__) +# pragma GCC diagnostic pop #endif diff --git a/src/Base/swigpyrun_1.3.38.cpp b/src/Base/swigpyrun_1.3.38.cpp index ee10af8606..26ac8f6c8c 100644 --- a/src/Base/swigpyrun_1.3.38.cpp +++ b/src/Base/swigpyrun_1.3.38.cpp @@ -28,6 +28,11 @@ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wdeprecated-register" # pragma clang diagnostic ignored "-Wself-assign" +#elif defined (__GNUC__) +# pragma GCC diagnostic push +# if __GNUC__ >= 8 +# pragma GCC diagnostic ignored "-Wcast-function-type" +# endif #endif namespace Swig_1_3_38 { #define SWIG_PYTHON_NO_BUILD_NONE @@ -36,5 +41,7 @@ namespace Swig_1_3_38 { } #if defined(__clang__) # pragma clang diagnostic pop +#elif defined (__GNUC__) +# pragma GCC diagnostic pop #endif diff --git a/src/Base/swigpyrun_1.3.40.cpp b/src/Base/swigpyrun_1.3.40.cpp index bbce2e695c..e11f174d71 100644 --- a/src/Base/swigpyrun_1.3.40.cpp +++ b/src/Base/swigpyrun_1.3.40.cpp @@ -28,6 +28,11 @@ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wdeprecated-register" # pragma clang diagnostic ignored "-Wself-assign" +#elif defined (__GNUC__) +# pragma GCC diagnostic push +# if __GNUC__ >= 8 +# pragma GCC diagnostic ignored "-Wcast-function-type" +# endif #endif namespace Swig_1_3_40 { #define SWIG_PYTHON_NO_BUILD_NONE @@ -36,5 +41,7 @@ namespace Swig_1_3_40 { } #if defined(__clang__) # pragma clang diagnostic pop +#elif defined (__GNUC__) +# pragma GCC diagnostic pop #endif diff --git a/src/CXX/Python2/Extensions.hxx b/src/CXX/Python2/Extensions.hxx index ad9a5ebb27..b7bad2b649 100644 --- a/src/CXX/Python2/Extensions.hxx +++ b/src/CXX/Python2/Extensions.hxx @@ -159,7 +159,7 @@ namespace Py ) { ext_meth_def.ml_name = const_cast( _name ); - ext_meth_def.ml_meth = reinterpret_cast( _handler ); + ext_meth_def.ml_meth = reinterpret_cast(reinterpret_cast(_handler)); ext_meth_def.ml_flags = METH_VARARGS|METH_KEYWORDS; ext_meth_def.ml_doc = const_cast( _doc ); diff --git a/src/CXX/Python3/Extensions.hxx b/src/CXX/Python3/Extensions.hxx index f8b4c6f790..0a181d9f07 100644 --- a/src/CXX/Python3/Extensions.hxx +++ b/src/CXX/Python3/Extensions.hxx @@ -159,7 +159,7 @@ namespace Py ) { ext_meth_def.ml_name = const_cast( _name ); - ext_meth_def.ml_meth = reinterpret_cast( _handler ); + ext_meth_def.ml_meth = reinterpret_cast(reinterpret_cast(_handler)); ext_meth_def.ml_flags = METH_VARARGS|METH_KEYWORDS; ext_meth_def.ml_doc = const_cast( _doc ); diff --git a/src/Mod/Path/App/AreaPyImp.cpp b/src/Mod/Path/App/AreaPyImp.cpp index b73751409d..eaf76d0ada 100644 --- a/src/Mod/Path/App/AreaPyImp.cpp +++ b/src/Mod/Path/App/AreaPyImp.cpp @@ -148,7 +148,7 @@ static const PyMethodDef areaOverrides[] = { "of this Area is used if section mode is 'Workplane'.", }, { - "setDefaultParams",(PyCFunction)areaSetParams, METH_VARARGS|METH_KEYWORDS|METH_STATIC, + "setDefaultParams",reinterpret_cast(reinterpret_cast(areaSetParams)), METH_VARARGS|METH_KEYWORDS|METH_STATIC, "setDefaultParams(key=value...):\n" "Static method to set the default parameters of all following Path.Area, plus the following\n" "additional parameters.\n" @@ -158,13 +158,13 @@ static const PyMethodDef areaOverrides[] = { "getDefaultParams(): Static method to return the current default parameters." }, { - "abort",(PyCFunction)areaAbort, METH_VARARGS|METH_KEYWORDS|METH_STATIC, + "abort",reinterpret_cast(reinterpret_cast(areaAbort)), METH_VARARGS|METH_KEYWORDS|METH_STATIC, "abort(aborting=True): Static method to abort any ongoing operation\n" "\nTo ensure no stray abortion is left in the previous operation, it is advised to manually clear\n" "the aborting flag by calling abort(False) before starting a new operation.", }, { - "getParamsDesc",(PyCFunction)areaGetParamsDesc, METH_VARARGS|METH_KEYWORDS|METH_STATIC, + "getParamsDesc",reinterpret_cast(reinterpret_cast(areaGetParamsDesc)), METH_VARARGS|METH_KEYWORDS|METH_STATIC, "getParamsDesc(as_string=False): Returns a list of supported parameters and their descriptions.\n" "\n* as_string: if False, then return a dictionary of documents of all supported parameters." }, diff --git a/src/Tools/generateTemplates/templateClassPyExport.py b/src/Tools/generateTemplates/templateClassPyExport.py index 2aeaa4358a..728aafbdb6 100644 --- a/src/Tools/generateTemplates/templateClassPyExport.py +++ b/src/Tools/generateTemplates/templateClassPyExport.py @@ -351,10 +351,11 @@ PyTypeObject @self.export.Name@::Type = { PyMethodDef @self.export.Name@::Methods[] = { + for i in self.export.Methode: {"@i.Name@", - (PyCFunction) staticCallback_@i.Name@, + if i.Keyword: + reinterpret_cast(reinterpret_cast( staticCallback_@i.Name@ )), METH_VARARGS|METH_KEYWORDS, = else: + reinterpret_cast( staticCallback_@i.Name@ ), METH_VARARGS, - "@i.Documentation.UserDocu.replace('\\n','\\\\n')@"