mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
generic: cleanup kdemacros header
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
05e9f6eb26
commit
cd441bc501
1 changed files with 2 additions and 192 deletions
|
@ -191,16 +191,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef KDE_CONSTRUCTOR_DEPRECATED
|
#ifndef KDE_CONSTRUCTOR_DEPRECATED
|
||||||
# ifdef __GNUC__
|
# define KDE_CONSTRUCTOR_DEPRECATED Q_DECL_CONSTRUCTOR_DEPRECATED
|
||||||
# if __GNUC__ == 3 && __GNUC_MINOR__ <= 3
|
|
||||||
/* GCC 3.3.x cannot handle Qt 4.1.2's definition of Q_DECL_CONSTRUCTOR_DEPRECATED */
|
|
||||||
# define KDE_CONSTRUCTOR_DEPRECATED
|
|
||||||
# else
|
|
||||||
# define KDE_CONSTRUCTOR_DEPRECATED Q_DECL_CONSTRUCTOR_DEPRECATED
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# define KDE_CONSTRUCTOR_DEPRECATED Q_DECL_CONSTRUCTOR_DEPRECATED
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -272,7 +263,7 @@
|
||||||
* @sa KDE_ISLIKELY
|
* @sa KDE_ISLIKELY
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__GNUC__) && __GNUC__ - 0 >= 3
|
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||||
# define KDE_ISLIKELY( x ) __builtin_expect(!!(x),1)
|
# define KDE_ISLIKELY( x ) __builtin_expect(!!(x),1)
|
||||||
# define KDE_ISUNLIKELY( x ) __builtin_expect(!!(x),0)
|
# define KDE_ISUNLIKELY( x ) __builtin_expect(!!(x),0)
|
||||||
#else
|
#else
|
||||||
|
@ -280,185 +271,4 @@
|
||||||
# define KDE_ISUNLIKELY( x ) ( x )
|
# define KDE_ISUNLIKELY( x ) ( x )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ingroup KDEMacros
|
|
||||||
* This macro, and it's friends going up to 10 reserve a fixed number of virtual
|
|
||||||
* functions in a class. Because adding virtual functions to a class changes the
|
|
||||||
* size of the vtable, adding virtual functions to a class breaks binary
|
|
||||||
* compatibility. However, by using this macro, and decrementing it as new
|
|
||||||
* virtual methods are added, binary compatibility can still be preserved.
|
|
||||||
*
|
|
||||||
* \note The added functions must be added to the header at the same location
|
|
||||||
* as the macro; changing the order of virtual functions in a header is also
|
|
||||||
* binary incompatible as it breaks the layout of the vtable.
|
|
||||||
*/
|
|
||||||
#define RESERVE_VIRTUAL_1 \
|
|
||||||
virtual void reservedVirtual1() {}
|
|
||||||
/**
|
|
||||||
* @ingroup KDEMacros
|
|
||||||
*/
|
|
||||||
#define RESERVE_VIRTUAL_2 \
|
|
||||||
virtual void reservedVirtual2() {} \
|
|
||||||
RESERVE_VIRTUAL_1
|
|
||||||
/**
|
|
||||||
* @ingroup KDEMacros
|
|
||||||
*/
|
|
||||||
#define RESERVE_VIRTUAL_3 \
|
|
||||||
virtual void reservedVirtual3() {} \
|
|
||||||
RESERVE_VIRTUAL_2
|
|
||||||
/**
|
|
||||||
* @ingroup KDEMacros
|
|
||||||
*/
|
|
||||||
#define RESERVE_VIRTUAL_4 \
|
|
||||||
virtual void reservedVirtual4() {} \
|
|
||||||
RESERVE_VIRTUAL_3
|
|
||||||
/**
|
|
||||||
* @ingroup KDEMacros
|
|
||||||
*/
|
|
||||||
#define RESERVE_VIRTUAL_5 \
|
|
||||||
virtual void reservedVirtual5() {} \
|
|
||||||
RESERVE_VIRTUAL_4
|
|
||||||
/**
|
|
||||||
* @ingroup KDEMacros
|
|
||||||
*/
|
|
||||||
#define RESERVE_VIRTUAL_6 \
|
|
||||||
virtual void reservedVirtual6() {} \
|
|
||||||
RESERVE_VIRTUAL_5
|
|
||||||
/**
|
|
||||||
* @ingroup KDEMacros
|
|
||||||
*/
|
|
||||||
#define RESERVE_VIRTUAL_7 \
|
|
||||||
virtual void reservedVirtual7() {} \
|
|
||||||
RESERVE_VIRTUAL_6
|
|
||||||
/**
|
|
||||||
* @ingroup KDEMacros
|
|
||||||
*/
|
|
||||||
#define RESERVE_VIRTUAL_8 \
|
|
||||||
virtual void reservedVirtual8() {} \
|
|
||||||
RESERVE_VIRTUAL_7
|
|
||||||
/**
|
|
||||||
* @ingroup KDEMacros
|
|
||||||
*/
|
|
||||||
#define RESERVE_VIRTUAL_9 \
|
|
||||||
virtual void reservedVirtual9() {} \
|
|
||||||
RESERVE_VIRTUAL_8
|
|
||||||
#define RESERVE_VIRTUAL_10 \
|
|
||||||
virtual void reservedVirtual10() {} \
|
|
||||||
RESERVE_VIRTUAL_9
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @def KDE_FULL_TEMPLATE_EXPORT_INSTANTIATION
|
|
||||||
* @ingroup KDEMacros
|
|
||||||
*
|
|
||||||
* From Qt's global.h:
|
|
||||||
* Compilers which follow outdated template instantiation rules
|
|
||||||
* require a class to have a comparison operator to exist when
|
|
||||||
* a QList of this type is instantiated. It's not actually
|
|
||||||
* used in the list, though. Hence the dummy implementation.
|
|
||||||
* Just in case other code relies on it we better trigger a warning
|
|
||||||
* mandating a real implementation.
|
|
||||||
*
|
|
||||||
* In KDE we need this for classes which are exported in a shared
|
|
||||||
* lib because some compilers need a full instantiated class then.
|
|
||||||
*
|
|
||||||
* @sa KDE_DUMMY_COMPARISON_OPERATOR
|
|
||||||
* @sa KDE_DUMMY_QHASH_FUNCTION
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @def KDE_DUMMY_COMPARISON_OPERATOR
|
|
||||||
* @ingroup KDEMacros
|
|
||||||
*
|
|
||||||
* The KDE_DUMMY_COMPARISON_OPERATOR defines a simple
|
|
||||||
* compare operator for classes.
|
|
||||||
*
|
|
||||||
* @sa KDE_FULL_TEMPLATE_EXPORT_INSTANTIATION
|
|
||||||
* @sa KDE_DUMMY_QHASH_FUNCTION
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @def KDE_DUMMY_QHASH_FUNCTION
|
|
||||||
* @ingroup KDEMacros
|
|
||||||
*
|
|
||||||
* The KDE_DUMMY_QHASH_FUNCTION defines a simple
|
|
||||||
* hash-function for classes.
|
|
||||||
*
|
|
||||||
* @sa KDE_FULL_TEMPLATE_EXPORT_INSTANTIATION
|
|
||||||
* @sa KDE_DUMMY_COMPARISON_OPERATOR
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef KDE_FULL_TEMPLATE_EXPORT_INSTANTIATION
|
|
||||||
# define KDE_DUMMY_COMPARISON_OPERATOR(C) \
|
|
||||||
bool operator==(const C&) const { \
|
|
||||||
qWarning(#C"::operator==(const "#C"&) was called"); \
|
|
||||||
return false; \
|
|
||||||
}
|
|
||||||
# define KDE_DUMMY_QHASH_FUNCTION(C) \
|
|
||||||
inline uint qHash(const C) { \
|
|
||||||
qWarning("inline uint qHash(const "#C") was called"); \
|
|
||||||
return 0; \
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
# define KDE_DUMMY_COMPARISON_OPERATOR(C)
|
|
||||||
# define KDE_DUMMY_QHASH_FUNCTION(C)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @def KDE_BF_ENUM
|
|
||||||
* @ingroup KDEMacros
|
|
||||||
*
|
|
||||||
* The KDE_BF_ENUM is used when storing an enum
|
|
||||||
* in a bitfield, to ensure correct conversion
|
|
||||||
* by all compilers.
|
|
||||||
*
|
|
||||||
* @sa KDE_CAST_BF_ENUM
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @def KDE_CAST_BF_ENUM
|
|
||||||
* @ingroup KDEMacros
|
|
||||||
*
|
|
||||||
* The KDE_CAST_BF_ENUM is used when retrieving an
|
|
||||||
* enum from a bitfield, to ensure correct conversion
|
|
||||||
* by all compilers.
|
|
||||||
*
|
|
||||||
* @sa KDE_BF_ENUM
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define KDE_BF_ENUM(a) a
|
|
||||||
#define KDE_CAST_BF_ENUM(a,b) b
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @def KDE_WEAK_SYMBOL
|
|
||||||
* @ingroup KDEMacros
|
|
||||||
*
|
|
||||||
* The KDE_WEAK_SYMBOL macro can be used to tell the compiler that
|
|
||||||
* a particular function should be a weak symbol (that e.g. may be overridden
|
|
||||||
* in another library, -Bdirect will not bind this symbol directly)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#define KDE_WEAK_SYMBOL __attribute__((__weak__))
|
|
||||||
#else
|
|
||||||
#define KDE_WEAK_SYMBOL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @def KDE_MUST_USE_RESULT
|
|
||||||
* @ingroup KDEMacros
|
|
||||||
*
|
|
||||||
* The KDE_MUST_USE_RESULT macro can be used to tell the compiler that
|
|
||||||
* a particular functions return value must be checked.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#define KDE_MUST_USE_RESULT __attribute__((__warn_unused_result__))
|
|
||||||
#else
|
|
||||||
#define KDE_MUST_USE_RESULT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* _KDE_MACROS_H_ */
|
#endif /* _KDE_MACROS_H_ */
|
||||||
|
|
Loading…
Add table
Reference in a new issue