qtnamespacemacros.h: make Q_MANGLE_NAMESPACE() available in C mode

Pretty sure that's what the macro was for anyway.

Change-Id: Ic15405335d804bdea761fffd16d50d94b95192db
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Thiago Macieira 2022-02-18 18:02:51 -08:00
parent 1ee1e4f6ac
commit 20575393f4

View File

@ -40,6 +40,17 @@
#ifndef QTNAMESPACEMACROS_H
#define QTNAMESPACEMACROS_H
// valid for both C and C++
#define QT_MANGLE_NAMESPACE0(x) x
#define QT_MANGLE_NAMESPACE1(a, b) a##_##b
#define QT_MANGLE_NAMESPACE2(a, b) QT_MANGLE_NAMESPACE1(a,b)
#if !defined(QT_NAMESPACE) || defined(Q_MOC_RUN) /* user namespace */
# define QT_MANGLE_NAMESPACE(name) name
#else
# define QT_MANGLE_NAMESPACE(name) QT_MANGLE_NAMESPACE2( \
QT_MANGLE_NAMESPACE0(name), QT_MANGLE_NAMESPACE0(QT_NAMESPACE))
#endif
#ifdef __cplusplus
#if !defined(QT_NAMESPACE) || defined(Q_MOC_RUN) /* user namespace */
@ -58,7 +69,6 @@
#endif
# define QT_FORWARD_DECLARE_CLASS(name) class name;
# define QT_FORWARD_DECLARE_STRUCT(name) struct name;
# define QT_MANGLE_NAMESPACE(name) name
#else /* user namespace */
@ -82,12 +92,6 @@
QT_BEGIN_NAMESPACE struct name; QT_END_NAMESPACE \
using QT_PREPEND_NAMESPACE(name);
# define QT_MANGLE_NAMESPACE0(x) x
# define QT_MANGLE_NAMESPACE1(a, b) a##_##b
# define QT_MANGLE_NAMESPACE2(a, b) QT_MANGLE_NAMESPACE1(a,b)
# define QT_MANGLE_NAMESPACE(name) QT_MANGLE_NAMESPACE2( \
QT_MANGLE_NAMESPACE0(name), QT_MANGLE_NAMESPACE0(QT_NAMESPACE))
namespace QT_NAMESPACE {}
# ifndef QT_BOOTSTRAPPED