Mark some more functions with Q_DECL_CONST_FUNCTION

Saves a mere 300byte of text.

Change-Id: Ibc87a395af83757e855477a57e48e1e190504757
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Giuseppe D'Angelo 2017-04-04 00:41:34 +01:00
parent 49c4c061e0
commit 5c2d177552
5 changed files with 40 additions and 40 deletions

View File

@ -3069,7 +3069,7 @@ void qt_assert_x(const char *where, const char *what, const char *file, int line
Deliberately not exported as part of the Qt API, but used in both Deliberately not exported as part of the Qt API, but used in both
qsimplerichtext.cpp and qgfxraster_qws.cpp qsimplerichtext.cpp and qgfxraster_qws.cpp
*/ */
Q_CORE_EXPORT unsigned int qt_int_sqrt(unsigned int n) Q_CORE_EXPORT Q_DECL_CONST_FUNCTION unsigned int qt_int_sqrt(unsigned int n)
{ {
// n must be in the range 0...UINT_MAX/2-1 // n must be in the range 0...UINT_MAX/2-1
if (n >= (UINT_MAX>>2)) { if (n >= (UINT_MAX>>2)) {

View File

@ -355,7 +355,7 @@ typedef double qreal;
#if !defined(QT_NAMESPACE) && defined(__cplusplus) && !defined(Q_QDOC) #if !defined(QT_NAMESPACE) && defined(__cplusplus) && !defined(Q_QDOC)
extern "C" extern "C"
#endif #endif
Q_CORE_EXPORT const char *qVersion() Q_DECL_NOTHROW; Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion() Q_DECL_NOTHROW;
#if defined(__cplusplus) #if defined(__cplusplus)
@ -668,7 +668,7 @@ Q_NORETURN Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW;
# endif # endif
#endif #endif
Q_CORE_EXPORT bool qSharedBuild() Q_DECL_NOTHROW; Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() Q_DECL_NOTHROW;
#ifndef Q_OUTOFLINE_TEMPLATE #ifndef Q_OUTOFLINE_TEMPLATE
# define Q_OUTOFLINE_TEMPLATE # define Q_OUTOFLINE_TEMPLATE

View File

@ -45,15 +45,15 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
Q_CORE_EXPORT bool qIsInf(double d); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsInf(double d);
Q_CORE_EXPORT bool qIsNaN(double d); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsNaN(double d);
Q_CORE_EXPORT bool qIsFinite(double d); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsFinite(double d);
Q_CORE_EXPORT bool qIsInf(float f); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsInf(float f);
Q_CORE_EXPORT bool qIsNaN(float f); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsNaN(float f);
Q_CORE_EXPORT bool qIsFinite(float f); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsFinite(float f);
Q_CORE_EXPORT double qSNaN(); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qSNaN();
Q_CORE_EXPORT double qQNaN(); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qQNaN();
Q_CORE_EXPORT double qInf(); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qInf();
Q_CORE_EXPORT quint32 qFloatDistance(float a, float b); Q_CORE_EXPORT quint32 qFloatDistance(float a, float b);
Q_CORE_EXPORT quint64 qFloatDistance(double a, double b); Q_CORE_EXPORT quint64 qFloatDistance(double a, double b);

View File

@ -73,12 +73,12 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace qnumeric_std_wrapper { namespace qnumeric_std_wrapper {
// the 'using namespace std' below is cases where the stdlib already put the math.h functions in the std namespace and undefined the macros. // the 'using namespace std' below is cases where the stdlib already put the math.h functions in the std namespace and undefined the macros.
static inline bool math_h_isnan(double d) { using namespace std; return isnan(d); } Q_DECL_CONST_FUNCTION static inline bool math_h_isnan(double d) { using namespace std; return isnan(d); }
static inline bool math_h_isinf(double d) { using namespace std; return isinf(d); } Q_DECL_CONST_FUNCTION static inline bool math_h_isinf(double d) { using namespace std; return isinf(d); }
static inline bool math_h_isfinite(double d) { using namespace std; return isfinite(d); } Q_DECL_CONST_FUNCTION static inline bool math_h_isfinite(double d) { using namespace std; return isfinite(d); }
static inline bool math_h_isnan(float f) { using namespace std; return isnan(f); } Q_DECL_CONST_FUNCTION static inline bool math_h_isnan(float f) { using namespace std; return isnan(f); }
static inline bool math_h_isinf(float f) { using namespace std; return isinf(f); } Q_DECL_CONST_FUNCTION static inline bool math_h_isinf(float f) { using namespace std; return isinf(f); }
static inline bool math_h_isfinite(float f) { using namespace std; return isfinite(f); } Q_DECL_CONST_FUNCTION static inline bool math_h_isfinite(float f) { using namespace std; return isfinite(f); }
} }
QT_END_NAMESPACE QT_END_NAMESPACE
// These macros from math.h conflict with the real functions in the std namespace. // These macros from math.h conflict with the real functions in the std namespace.
@ -94,23 +94,23 @@ QT_BEGIN_NAMESPACE
namespace qnumeric_std_wrapper { namespace qnumeric_std_wrapper {
#if defined(QT_MATH_H_DEFINES_MACROS) #if defined(QT_MATH_H_DEFINES_MACROS)
# undef QT_MATH_H_DEFINES_MACROS # undef QT_MATH_H_DEFINES_MACROS
static inline bool isnan(double d) { return math_h_isnan(d); } Q_DECL_CONST_FUNCTION static inline bool isnan(double d) { return math_h_isnan(d); }
static inline bool isinf(double d) { return math_h_isinf(d); } Q_DECL_CONST_FUNCTION static inline bool isinf(double d) { return math_h_isinf(d); }
static inline bool isfinite(double d) { return math_h_isfinite(d); } Q_DECL_CONST_FUNCTION static inline bool isfinite(double d) { return math_h_isfinite(d); }
static inline bool isnan(float f) { return math_h_isnan(f); } Q_DECL_CONST_FUNCTION static inline bool isnan(float f) { return math_h_isnan(f); }
static inline bool isinf(float f) { return math_h_isinf(f); } Q_DECL_CONST_FUNCTION static inline bool isinf(float f) { return math_h_isinf(f); }
static inline bool isfinite(float f) { return math_h_isfinite(f); } Q_DECL_CONST_FUNCTION static inline bool isfinite(float f) { return math_h_isfinite(f); }
#else #else
static inline bool isnan(double d) { return std::isnan(d); } Q_DECL_CONST_FUNCTION static inline bool isnan(double d) { return std::isnan(d); }
static inline bool isinf(double d) { return std::isinf(d); } Q_DECL_CONST_FUNCTION static inline bool isinf(double d) { return std::isinf(d); }
static inline bool isfinite(double d) { return std::isfinite(d); } Q_DECL_CONST_FUNCTION static inline bool isfinite(double d) { return std::isfinite(d); }
static inline bool isnan(float f) { return std::isnan(f); } Q_DECL_CONST_FUNCTION static inline bool isnan(float f) { return std::isnan(f); }
static inline bool isinf(float f) { return std::isinf(f); } Q_DECL_CONST_FUNCTION static inline bool isinf(float f) { return std::isinf(f); }
static inline bool isfinite(float f) { return std::isfinite(f); } Q_DECL_CONST_FUNCTION static inline bool isfinite(float f) { return std::isfinite(f); }
#endif #endif
} }
Q_DECL_CONSTEXPR static inline double qt_inf() Q_DECL_NOEXCEPT Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_inf() Q_DECL_NOEXCEPT
{ {
Q_STATIC_ASSERT_X(std::numeric_limits<double>::has_infinity, Q_STATIC_ASSERT_X(std::numeric_limits<double>::has_infinity,
"platform has no definition for infinity for type double"); "platform has no definition for infinity for type double");
@ -118,7 +118,7 @@ Q_DECL_CONSTEXPR static inline double qt_inf() Q_DECL_NOEXCEPT
} }
// Signaling NaN // Signaling NaN
Q_DECL_CONSTEXPR static inline double qt_snan() Q_DECL_NOEXCEPT Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_snan() Q_DECL_NOEXCEPT
{ {
Q_STATIC_ASSERT_X(std::numeric_limits<double>::has_signaling_NaN, Q_STATIC_ASSERT_X(std::numeric_limits<double>::has_signaling_NaN,
"platform has no definition for signaling NaN for type double"); "platform has no definition for signaling NaN for type double");
@ -126,39 +126,39 @@ Q_DECL_CONSTEXPR static inline double qt_snan() Q_DECL_NOEXCEPT
} }
// Quiet NaN // Quiet NaN
Q_DECL_CONSTEXPR static inline double qt_qnan() Q_DECL_NOEXCEPT Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_qnan() Q_DECL_NOEXCEPT
{ {
Q_STATIC_ASSERT_X(std::numeric_limits<double>::has_quiet_NaN, Q_STATIC_ASSERT_X(std::numeric_limits<double>::has_quiet_NaN,
"platform has no definition for quiet NaN for type double"); "platform has no definition for quiet NaN for type double");
return std::numeric_limits<double>::quiet_NaN(); return std::numeric_limits<double>::quiet_NaN();
} }
static inline bool qt_is_inf(double d) Q_DECL_CONST_FUNCTION static inline bool qt_is_inf(double d)
{ {
return qnumeric_std_wrapper::isinf(d); return qnumeric_std_wrapper::isinf(d);
} }
static inline bool qt_is_nan(double d) Q_DECL_CONST_FUNCTION static inline bool qt_is_nan(double d)
{ {
return qnumeric_std_wrapper::isnan(d); return qnumeric_std_wrapper::isnan(d);
} }
static inline bool qt_is_finite(double d) Q_DECL_CONST_FUNCTION static inline bool qt_is_finite(double d)
{ {
return qnumeric_std_wrapper::isfinite(d); return qnumeric_std_wrapper::isfinite(d);
} }
static inline bool qt_is_inf(float f) Q_DECL_CONST_FUNCTION static inline bool qt_is_inf(float f)
{ {
return qnumeric_std_wrapper::isinf(f); return qnumeric_std_wrapper::isinf(f);
} }
static inline bool qt_is_nan(float f) Q_DECL_CONST_FUNCTION static inline bool qt_is_nan(float f)
{ {
return qnumeric_std_wrapper::isnan(f); return qnumeric_std_wrapper::isnan(f);
} }
static inline bool qt_is_finite(float f) Q_DECL_CONST_FUNCTION static inline bool qt_is_finite(float f)
{ {
return qnumeric_std_wrapper::isfinite(f); return qnumeric_std_wrapper::isfinite(f);
} }

View File

@ -71,7 +71,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
Q_CORE_EXPORT unsigned int qt_int_sqrt(unsigned int n); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION unsigned int qt_int_sqrt(unsigned int n);
/*! /*!
Returns \c true if the string \a text is likely to be rich text; Returns \c true if the string \a text is likely to be rich text;