From d53093953f8f3b58600cb19020ecbe0b5f254b52 Mon Sep 17 00:00:00 2001 From: Stefan Werner Date: Mon, 25 Jun 2018 23:02:01 +0200 Subject: Turned off clang warnings in third party includes. The latest clang compiler (at least the one in Xcode 9.4.1) warns about the register keyword and macro expansions using defined(). Since these warnings come from third party code, we can't address them directly in Blender. Silencing them via #pramgas will at least keep the warnings during a build down to the ones that are relevant to Blender code. --- intern/cycles/device/device_cpu.cpp | 3 +++ intern/cycles/kernel/osl/osl_closures.cpp | 4 ++++ intern/cycles/kernel/osl/osl_shader.cpp | 3 +++ intern/cycles/render/shader.h | 3 +++ intern/cycles/util/util_image.h | 4 ++++ intern/cycles/util/util_param.h | 4 ++++ source/blender/imbuf/intern/openexr/openexr_api.cpp | 4 ++++ 7 files changed, 25 insertions(+) diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index 6be60f8bbb6..3b0d0fb9806 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -21,7 +21,10 @@ #ifdef WITH_OSL /* So no context pollution happens from indirectly included windows.h */ # include "util/util_windows.h" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-register" # include +# pragma clang diagnostic pop #endif #include "device/device.h" diff --git a/intern/cycles/kernel/osl/osl_closures.cpp b/intern/cycles/kernel/osl/osl_closures.cpp index 6a1e52d7d16..e928006e41a 100644 --- a/intern/cycles/kernel/osl/osl_closures.cpp +++ b/intern/cycles/kernel/osl/osl_closures.cpp @@ -30,8 +30,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-register" +#pragma clang diagnostic ignored "-Wexpansion-to-defined" #include #include +#pragma clang diagnostic pop #include "kernel/osl/osl_closures.h" #include "kernel/osl/osl_shader.h" diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp index b7d1c629291..8757b9a748b 100644 --- a/intern/cycles/kernel/osl/osl_shader.cpp +++ b/intern/cycles/kernel/osl/osl_shader.cpp @@ -14,7 +14,10 @@ * limitations under the License. */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-register" #include +#pragma clang diagnostic pop #include "kernel/kernel_compat_cpu.h" #include "kernel/kernel_montecarlo.h" diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h index 0353da90013..dd346ef5795 100644 --- a/intern/cycles/render/shader.h +++ b/intern/cycles/render/shader.h @@ -20,7 +20,10 @@ #ifdef WITH_OSL /* So no context pollution happens from indirectly included windows.h */ # include "util/util_windows.h" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-register" # include +# pragma clang diagnostic pop #endif #include "render/attribute.h" diff --git a/intern/cycles/util/util_image.h b/intern/cycles/util/util_image.h index 18876841b5b..38694c87d0e 100644 --- a/intern/cycles/util/util_image.h +++ b/intern/cycles/util/util_image.h @@ -19,7 +19,11 @@ /* OpenImageIO is used for all image file reading and writing. */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-register" +#pragma clang diagnostic ignored "-Wexpansion-to-defined" #include +#pragma clang diagnostic pop #include "util/util_vector.h" diff --git a/intern/cycles/util/util_param.h b/intern/cycles/util/util_param.h index 69bcbf80a78..419a8010d5a 100644 --- a/intern/cycles/util/util_param.h +++ b/intern/cycles/util/util_param.h @@ -20,9 +20,13 @@ /* Parameter value lists from OpenImageIO are used to store custom properties * on various data, which can then later be used in shaders. */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-register" +#pragma clang diagnostic ignored "-Wexpansion-to-defined" #include #include #include +#pragma clang diagnostic pop CCL_NAMESPACE_BEGIN diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index a52ae75e87b..13c033523fa 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -40,6 +40,9 @@ #include #include + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-register" #include #include #include @@ -64,6 +67,7 @@ #include #include #include +#pragma clang diagnostic pop #include "DNA_scene_types.h" /* For OpenEXR compression constants */ -- cgit v1.2.3 From 87f598fd3f2b7968af0620b98f16bb86aa17d541 Mon Sep 17 00:00:00 2001 From: Lukas Stockner Date: Tue, 26 Jun 2018 05:34:30 +0200 Subject: Cycles: Fix wrong row count for World MIS CDF calculation --- intern/cycles/render/light.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 20c6a53e58f..122c5dfb07a 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -586,7 +586,7 @@ void LightManager::device_update_background(Device *device, double time_start = time_dt(); if(max(res.x, res.y) < 512) { /* Small enough resolution, faster to do single-threaded. */ - background_cdf(0, res.x, res.x, res.y, &pixels, cond_cdf); + background_cdf(0, res.y, res.x, res.y, &pixels, cond_cdf); } else { /* Threaded evaluation for large resolution. */ -- cgit v1.2.3 From a69f985f40905b01cf542d370831e7ade138a4e3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 26 Jun 2018 09:26:52 +0200 Subject: PyAPI: move deep-copy args check to py_capi_utils --- source/blender/python/generic/py_capi_utils.c | 6 ++++++ source/blender/python/generic/py_capi_utils.h | 1 + source/blender/python/mathutils/mathutils.c | 7 ------- source/blender/python/mathutils/mathutils.h | 2 -- source/blender/python/mathutils/mathutils_Color.c | 4 +++- source/blender/python/mathutils/mathutils_Euler.c | 4 +++- source/blender/python/mathutils/mathutils_Matrix.c | 4 +++- source/blender/python/mathutils/mathutils_Quaternion.c | 5 +++-- source/blender/python/mathutils/mathutils_Vector.c | 3 ++- 9 files changed, 21 insertions(+), 15 deletions(-) diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 22646462163..cee9ad3b477 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -230,6 +230,12 @@ int PyC_ParseBool(PyObject *o, void *p) return 1; } +/* silly function, we dont use arg. just check its compatible with __deepcopy__ */ +int PyC_CheckArgs_DeepCopy(PyObject *args) +{ + PyObject *dummy_pydict; + return PyArg_ParseTuple(args, "|O!:__deepcopy__", &PyDict_Type, &dummy_pydict) != 0; +} #ifndef MATH_STANDALONE diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h index fe7a046d99c..10419ce71d4 100644 --- a/source/blender/python/generic/py_capi_utils.h +++ b/source/blender/python/generic/py_capi_utils.h @@ -106,6 +106,7 @@ bool PyC_RunString_AsString(const char *expr, const char *filename, char **r_val int PyC_ParseBool(PyObject *o, void *p); +int PyC_CheckArgs_DeepCopy(PyObject *args); /* Integer parsing (with overflow checks), -1 on error. */ int PyC_Long_AsBool(PyObject *value); diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c index 96ae0a9e50f..0c365ad192c 100644 --- a/source/blender/python/mathutils/mathutils.c +++ b/source/blender/python/mathutils/mathutils.c @@ -419,13 +419,6 @@ PyObject *mathutils_dynstr_to_py(struct DynStr *ds) } #endif -/* silly function, we dont use arg. just check its compatible with __deepcopy__ */ -int mathutils_deepcopy_args_check(PyObject *args) -{ - PyObject *dummy_pydict; - return PyArg_ParseTuple(args, "|O!:__deepcopy__", &PyDict_Type, &dummy_pydict) != 0; -} - /* Mathutils Callbacks */ /* for mathutils internal use only, eventually should re-alloc but to start with we only have a few users */ diff --git a/source/blender/python/mathutils/mathutils.h b/source/blender/python/mathutils/mathutils.h index ec927a9e316..b151ba7280d 100644 --- a/source/blender/python/mathutils/mathutils.h +++ b/source/blender/python/mathutils/mathutils.h @@ -174,6 +174,4 @@ int column_vector_multiplication(float rvec[4], VectorObject *vec, MatrixObject PyObject *mathutils_dynstr_to_py(struct DynStr *ds); #endif -int mathutils_deepcopy_args_check(PyObject *args); - #endif /* __MATHUTILS_H__ */ diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index 9997cd9c1f5..4c1163a6181 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -33,6 +33,7 @@ #include "BLI_utildefines.h" #include "../generic/python_utildefines.h" +#include "../generic/py_capi_utils.h" #ifndef MATH_STANDALONE # include "BLI_dynstr.h" @@ -113,8 +114,9 @@ static PyObject *Color_copy(ColorObject *self) } static PyObject *Color_deepcopy(ColorObject *self, PyObject *args) { - if (!mathutils_deepcopy_args_check(args)) + if (!PyC_CheckArgs_DeepCopy(args)) { return NULL; + } return Color_copy(self); } diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index 026384743bd..8be3de42226 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -32,6 +32,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" #include "../generic/python_utildefines.h" +#include "../generic/py_capi_utils.h" #ifndef MATH_STANDALONE # include "BLI_dynstr.h" @@ -312,8 +313,9 @@ static PyObject *Euler_copy(EulerObject *self) } static PyObject *Euler_deepcopy(EulerObject *self, PyObject *args) { - if (!mathutils_deepcopy_args_check(args)) + if (!PyC_CheckArgs_DeepCopy(args)) { return NULL; + } return Euler_copy(self); } diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index cc6a5367895..70c400f99b8 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -33,6 +33,7 @@ #include "BLI_utildefines.h" #include "../generic/python_utildefines.h" +#include "../generic/py_capi_utils.h" #ifndef MATH_STANDALONE # include "BLI_string.h" @@ -1945,8 +1946,9 @@ static PyObject *Matrix_copy(MatrixObject *self) } static PyObject *Matrix_deepcopy(MatrixObject *self, PyObject *args) { - if (!mathutils_deepcopy_args_check(args)) + if (!PyC_CheckArgs_DeepCopy(args)) { return NULL; + } return Matrix_copy(self); } diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index d283c717a46..1a6fd0ee86f 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -33,6 +33,7 @@ #include "BLI_utildefines.h" #include "../generic/python_utildefines.h" +#include "../generic/py_capi_utils.h" #ifndef MATH_STANDALONE # include "BLI_dynstr.h" @@ -496,8 +497,9 @@ static PyObject *Quaternion_copy(QuaternionObject *self) } static PyObject *Quaternion_deepcopy(QuaternionObject *self, PyObject *args) { - if (!mathutils_deepcopy_args_check(args)) + if (!PyC_CheckArgs_DeepCopy(args)) { return NULL; + } return Quaternion_copy(self); } @@ -1393,4 +1395,3 @@ PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, return (PyObject *)self; } - diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index 65450505e08..a06a63c8067 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -1331,8 +1331,9 @@ static PyObject *Vector_copy(VectorObject *self) } static PyObject *Vector_deepcopy(VectorObject *self, PyObject *args) { - if (!mathutils_deepcopy_args_check(args)) + if (!PyC_CheckArgs_DeepCopy(args)) { return NULL; + } return Vector_copy(self); } -- cgit v1.2.3 From df237b964b9c24c9ab315f6f31bf67990f1c2f7e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 26 Jun 2018 09:30:18 +0200 Subject: PyAPI: add ImBuf.copy DD348 by @kilon w/ edits. --- source/blender/python/generic/imbuf_py_api.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/source/blender/python/generic/imbuf_py_api.c b/source/blender/python/generic/imbuf_py_api.c index 2e32829bf6c..dfe4007e404 100644 --- a/source/blender/python/generic/imbuf_py_api.c +++ b/source/blender/python/generic/imbuf_py_api.c @@ -45,6 +45,8 @@ #include #include "BLI_fileops.h" +static PyObject *Py_ImBuf_CreatePyObject(ImBuf *ibuf); + /* -------------------------------------------------------------------- */ /** \name Type & Utilities * \{ */ @@ -109,6 +111,27 @@ static PyObject *py_imbuf_resize(Py_ImBuf *self, PyObject *args, PyObject *kw) Py_RETURN_NONE; } +PyDoc_STRVAR(py_imbuf_copy_doc, +".. method:: copy()\n" +"\n" +" :return: A copy of the image.\n" +" :rtype: :class:`ImBuf`\n" +); +static PyObject *py_imbuf_copy(Py_ImBuf *self) +{ + PY_IMBUF_CHECK_OBJ(self); + return Py_ImBuf_CreatePyObject(self->ibuf); +} + +static PyObject *py_imbuf_deepcopy(Py_ImBuf *self, PyObject *args) +{ + if (!PyC_CheckArgs_DeepCopy(args)) { + return NULL; + } + return py_imbuf_copy(self); +} + + PyDoc_STRVAR(py_imbuf_free_doc, ".. method:: free()\n" "\n" @@ -126,6 +149,9 @@ static PyObject *py_imbuf_free(Py_ImBuf *self) static struct PyMethodDef Py_ImBuf_methods[] = { {"resize", (PyCFunction)py_imbuf_resize, METH_VARARGS | METH_KEYWORDS, (char *)py_imbuf_resize_doc}, {"free", (PyCFunction)py_imbuf_free, METH_NOARGS, (char *)py_imbuf_free_doc}, + {"copy", (PyCFunction)py_imbuf_copy, METH_NOARGS, (char *)py_imbuf_copy_doc}, + {"__copy__", (PyCFunction)py_imbuf_copy, METH_NOARGS, (char *)py_imbuf_copy_doc}, + {"__deepcopy__", (PyCFunction)py_imbuf_deepcopy, METH_VARARGS, (char *)py_imbuf_copy_doc}, {NULL, NULL, 0, NULL} }; -- cgit v1.2.3