From 5c2d177552e0a009c463d76bf9a99e805273c948 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 4 Apr 2017 00:41:34 +0100 Subject: Mark some more functions with Q_DECL_CONST_FUNCTION Saves a mere 300byte of text. Change-Id: Ibc87a395af83757e855477a57e48e1e190504757 Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 2 +- src/corelib/global/qglobal.h | 4 +-- src/corelib/global/qnumeric.h | 18 +++++++------- src/corelib/global/qnumeric_p.h | 54 ++++++++++++++++++++--------------------- src/gui/text/qtextdocument.cpp | 2 +- 5 files changed, 40 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 4ff27f14a8..e7bfbb2903 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -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 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 if (n >= (UINT_MAX>>2)) { diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 3dfbf2fb2d..49577caba2 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -355,7 +355,7 @@ typedef double qreal; #if !defined(QT_NAMESPACE) && defined(__cplusplus) && !defined(Q_QDOC) extern "C" #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) @@ -668,7 +668,7 @@ Q_NORETURN Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW; # 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 # define Q_OUTOFLINE_TEMPLATE diff --git a/src/corelib/global/qnumeric.h b/src/corelib/global/qnumeric.h index 80be984bef..535a96aaec 100644 --- a/src/corelib/global/qnumeric.h +++ b/src/corelib/global/qnumeric.h @@ -45,15 +45,15 @@ QT_BEGIN_NAMESPACE -Q_CORE_EXPORT bool qIsInf(double d); -Q_CORE_EXPORT bool qIsNaN(double d); -Q_CORE_EXPORT bool qIsFinite(double d); -Q_CORE_EXPORT bool qIsInf(float f); -Q_CORE_EXPORT bool qIsNaN(float f); -Q_CORE_EXPORT bool qIsFinite(float f); -Q_CORE_EXPORT double qSNaN(); -Q_CORE_EXPORT double qQNaN(); -Q_CORE_EXPORT double qInf(); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsInf(double d); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsNaN(double d); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsFinite(double d); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsInf(float f); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsNaN(float f); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsFinite(float f); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qSNaN(); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qQNaN(); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qInf(); Q_CORE_EXPORT quint32 qFloatDistance(float a, float b); Q_CORE_EXPORT quint64 qFloatDistance(double a, double b); diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index 2291675501..37eddfa9b5 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -73,12 +73,12 @@ QT_BEGIN_NAMESPACE 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. -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); } -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); } -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_isnan(double d) { using namespace std; return isnan(d); } +Q_DECL_CONST_FUNCTION static inline bool math_h_isinf(double d) { using namespace std; return isinf(d); } +Q_DECL_CONST_FUNCTION static inline bool math_h_isfinite(double d) { using namespace std; return isfinite(d); } +Q_DECL_CONST_FUNCTION static inline bool math_h_isnan(float f) { using namespace std; return isnan(f); } +Q_DECL_CONST_FUNCTION static inline bool math_h_isinf(float f) { using namespace std; return isinf(f); } +Q_DECL_CONST_FUNCTION static inline bool math_h_isfinite(float f) { using namespace std; return isfinite(f); } } QT_END_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 { #if defined(QT_MATH_H_DEFINES_MACROS) # undef QT_MATH_H_DEFINES_MACROS -static inline bool isnan(double d) { return math_h_isnan(d); } -static inline bool isinf(double d) { return math_h_isinf(d); } -static inline bool isfinite(double d) { return math_h_isfinite(d); } -static inline bool isnan(float f) { return math_h_isnan(f); } -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 isnan(double d) { return math_h_isnan(d); } +Q_DECL_CONST_FUNCTION static inline bool isinf(double d) { return math_h_isinf(d); } +Q_DECL_CONST_FUNCTION static inline bool isfinite(double d) { return math_h_isfinite(d); } +Q_DECL_CONST_FUNCTION static inline bool isnan(float f) { return math_h_isnan(f); } +Q_DECL_CONST_FUNCTION static inline bool isinf(float f) { return math_h_isinf(f); } +Q_DECL_CONST_FUNCTION static inline bool isfinite(float f) { return math_h_isfinite(f); } #else -static inline bool isnan(double d) { return std::isnan(d); } -static inline bool isinf(double d) { return std::isinf(d); } -static inline bool isfinite(double d) { return std::isfinite(d); } -static inline bool isnan(float f) { return std::isnan(f); } -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 isnan(double d) { return std::isnan(d); } +Q_DECL_CONST_FUNCTION static inline bool isinf(double d) { return std::isinf(d); } +Q_DECL_CONST_FUNCTION static inline bool isfinite(double d) { return std::isfinite(d); } +Q_DECL_CONST_FUNCTION static inline bool isnan(float f) { return std::isnan(f); } +Q_DECL_CONST_FUNCTION static inline bool isinf(float f) { return std::isinf(f); } +Q_DECL_CONST_FUNCTION static inline bool isfinite(float f) { return std::isfinite(f); } #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::has_infinity, "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 -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::has_signaling_NaN, "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 -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::has_quiet_NaN, "platform has no definition for quiet NaN for type double"); return std::numeric_limits::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); } -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); } -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); } -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); } -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); } -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); } diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index f8215f92e9..db0650d154 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -71,7 +71,7 @@ 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; -- cgit v1.2.3