aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-11-26 10:36:11 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-11-26 11:56:24 +0000
commit73c27e00cd209be0bdbbea3abd333dd296352bd5 (patch)
treef829e5dfc627bf441168f6aab47bc42d8ff2adb1
parent499596609679fb490b29ddedf4be0664534583a3 (diff)
shiboken6: Remove macro SbkDbg
SbkDbg was a macro modeled after QDebug which produced some colored output on a terminal. It was (wrongly) used only in one place which caused a MSVC warning about missing macro parameters. Replace it by PyErr_WarnEx(). Change-Id: Ie0a134c864d8f434c7acefb22dac715012f36238 Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/shiboken6/libshiboken/CMakeLists.txt1
-rw-r--r--sources/shiboken6/libshiboken/bindingmanager.cpp1
-rw-r--r--sources/shiboken6/libshiboken/sbkconverter.cpp9
-rw-r--r--sources/shiboken6/libshiboken/sbkconverter_p.h2
-rw-r--r--sources/shiboken6/libshiboken/sbkdbg.h127
-rw-r--r--sources/shiboken6/libshiboken/sbkenum.cpp1
-rw-r--r--sources/shiboken6/libshiboken/tmp-referencetopython/sbkconverter.cpp2
7 files changed, 6 insertions, 137 deletions
diff --git a/sources/shiboken6/libshiboken/CMakeLists.txt b/sources/shiboken6/libshiboken/CMakeLists.txt
index 4504e7844..1fdc48ccc 100644
--- a/sources/shiboken6/libshiboken/CMakeLists.txt
+++ b/sources/shiboken6/libshiboken/CMakeLists.txt
@@ -131,7 +131,6 @@ install(FILES
sbkconverter.h
sbkenum.h
sbkmodule.h
- sbkdbg.h
sbkstring.h
sbkstaticstrings.h
shiboken.h
diff --git a/sources/shiboken6/libshiboken/bindingmanager.cpp b/sources/shiboken6/libshiboken/bindingmanager.cpp
index 78c03556c..3aea677bd 100644
--- a/sources/shiboken6/libshiboken/bindingmanager.cpp
+++ b/sources/shiboken6/libshiboken/bindingmanager.cpp
@@ -41,7 +41,6 @@
#include "basewrapper.h"
#include "basewrapper_p.h"
#include "bindingmanager.h"
-#include "sbkdbg.h"
#include "gilstate.h"
#include "sbkstring.h"
#include "sbkstaticstrings.h"
diff --git a/sources/shiboken6/libshiboken/sbkconverter.cpp b/sources/shiboken6/libshiboken/sbkconverter.cpp
index 29eb19715..0aabe5f60 100644
--- a/sources/shiboken6/libshiboken/sbkconverter.cpp
+++ b/sources/shiboken6/libshiboken/sbkconverter.cpp
@@ -43,10 +43,10 @@
#include "basewrapper_p.h"
#include "bindingmanager.h"
#include "autodecref.h"
-#include "sbkdbg.h"
#include "helper.h"
#include "voidptr.h"
+#include <string>
#include <unordered_map>
static SbkConverter **PrimitiveTypeConverters;
@@ -377,8 +377,11 @@ SbkConverter *getConverter(const char *typeName)
ConvertersMap::const_iterator it = converters.find(typeName);
if (it != converters.end())
return it->second;
- if (Py_VerboseFlag > 0)
- SbkDbg() << "Can't find type resolver for type '" << typeName << "'.";
+ if (Py_VerboseFlag > 0) {
+ const std::string message =
+ std::string("Can't find type resolver for type '") + typeName + "'.";
+ PyErr_WarnEx(PyExc_RuntimeWarning, message.c_str(), 0);
+ }
return nullptr;
}
diff --git a/sources/shiboken6/libshiboken/sbkconverter_p.h b/sources/shiboken6/libshiboken/sbkconverter_p.h
index 7508d98a4..80a2f2233 100644
--- a/sources/shiboken6/libshiboken/sbkconverter_p.h
+++ b/sources/shiboken6/libshiboken/sbkconverter_p.h
@@ -49,8 +49,6 @@
#include <iostream>
#include <vector>
-#include "sbkdbg.h"
-
extern "C"
{
diff --git a/sources/shiboken6/libshiboken/sbkdbg.h b/sources/shiboken6/libshiboken/sbkdbg.h
deleted file mode 100644
index 2a3211489..000000000
--- a/sources/shiboken6/libshiboken/sbkdbg.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SBKDBG_H
-#define SBKDBG_H
-
-#include "sbkpython.h"
-#include "basewrapper.h"
-#include <iostream>
-
-#ifndef NOCOLOR
- #define COLOR_END "\033[0m"
- #define COLOR_WHITE "\033[1;37m"
- #define COLOR_YELLOW "\033[1;33m"
- #define COLOR_GREEN "\033[0;32m"
- #define COLOR_RED "\033[0;31m"
-#else
- #define COLOR_END ""
- #define COLOR_WHITE ""
- #define COLOR_YELLOW ""
- #define COLOR_GREEN ""
- #define COLOR_RED ""
-#endif
-
-#ifndef NDEBUG
-
-class BaseLogger
-{
-public:
- BaseLogger(const BaseLogger &) = delete;
- BaseLogger(BaseLogger &&) = delete;
- BaseLogger &operator=(const BaseLogger &) = delete;
- BaseLogger &operator=(BaseLogger &&) = delete;
-
- BaseLogger(std::ostream &output, const char *function, const char *context)
- : m_stream(output), m_function(function), m_context(context) {}
- ~BaseLogger()
- {
- m_stream << std::endl;
- }
- std::ostream &operator()() { return m_stream; };
- template <typename T>
- std::ostream &operator<<(const T &t)
- {
- m_stream << '[';
- if (m_context[0])
- m_stream << COLOR_GREEN << m_context << COLOR_END << "|";
- return m_stream << COLOR_WHITE << m_function << COLOR_END << "] " << t;
- }
-private:
- std::ostream &m_stream;
- const char *m_function;
- const char *m_context;
-};
-
-inline std::ostream &operator<<(std::ostream &out, PyObject *obj)
-{
- PyObject *repr = Shiboken::Object::isValid(obj, false) ? PyObject_Repr(obj) : 0;
- if (repr) {
- PyObject *str = PyUnicode_AsUTF8String(repr);
- Py_DECREF(repr);
- repr = str;
- out << PyBytes_AS_STRING(repr);
- Py_DECREF(repr);
- } else {
- out << reinterpret_cast<void *>(obj);
- }
- return out;
-}
-
-class _SbkDbg : public BaseLogger
-{
-public:
- _SbkDbg(const char *function, const char *context = "") : BaseLogger(std::cout, function, context) {}
-};
-
-#ifdef __GNUG__
-#define SbkDbg(X) _SbkDbg(__PRETTY_FUNCTION__, X"")
-#else
-#define SbkDbg(X) _SbkDbg(__FUNCTION__, X"")
-#endif
-
-#else
-
-struct SbkDbg {
- template <typename T>
- SbkDbg &operator<<(const T &) { return *this; }
-};
-
-#endif
-#endif // LOGGER_H
diff --git a/sources/shiboken6/libshiboken/sbkenum.cpp b/sources/shiboken6/libshiboken/sbkenum.cpp
index fbf178b27..28840a7de 100644
--- a/sources/shiboken6/libshiboken/sbkenum.cpp
+++ b/sources/shiboken6/libshiboken/sbkenum.cpp
@@ -43,7 +43,6 @@
#include "sbkstaticstrings_p.h"
#include "sbkconverter.h"
#include "basewrapper.h"
-#include "sbkdbg.h"
#include "autodecref.h"
#include "sbkpython.h"
diff --git a/sources/shiboken6/libshiboken/tmp-referencetopython/sbkconverter.cpp b/sources/shiboken6/libshiboken/tmp-referencetopython/sbkconverter.cpp
index ab205e215..b16c1edf0 100644
--- a/sources/shiboken6/libshiboken/tmp-referencetopython/sbkconverter.cpp
+++ b/sources/shiboken6/libshiboken/tmp-referencetopython/sbkconverter.cpp
@@ -41,8 +41,6 @@
#include "sbkconverter_p.h"
#include "basewrapper_p.h"
-#include "sbkdbg.h"
-
namespace Shiboken {
namespace Conversions {