From a627c8628f14ba2b2fbcc908f5d1941ae73f0ad4 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 26 Dec 2014 21:43:40 +0100 Subject: [PATCH] QUnicodeTables: mark all functions as nothrow Yes, this is necessary. The noexcept operator looks for noexcept tagging, not at the contents of the function to determine whether to return true. The more conditionally-noexcept functions are used, the more important it becomes that low-level functions are correctly marked noexcept. In that, it is like constexpr. Change-Id: I4bca178444d1fd7caf3a92f996b1536eebdb5014 Reviewed-by: Thiago Macieira --- src/corelib/tools/qunicodetables.cpp | 16 ++++++------- src/corelib/tools/qunicodetables_p.h | 20 ++++++++-------- util/unicode/main.cpp | 36 ++++++++++++++-------------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/corelib/tools/qunicodetables.cpp b/src/corelib/tools/qunicodetables.cpp index 072e8ad920..477a0441b0 100644 --- a/src/corelib/tools/qunicodetables.cpp +++ b/src/corelib/tools/qunicodetables.cpp @@ -6912,44 +6912,44 @@ static const Properties uc_properties[] = { { 12, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 12, 0 } }; -Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(uint ucs4) +Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(uint ucs4) Q_DECL_NOTHROW { const int index = GET_PROP_INDEX(ucs4); return uc_properties + index; } -Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(ushort ucs2) +Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(ushort ucs2) Q_DECL_NOTHROW { const int index = GET_PROP_INDEX_UCS2(ucs2); return uc_properties + index; } -Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) +Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) Q_DECL_NOTHROW { return qGetProp(ucs4); } -Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) +Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) Q_DECL_NOTHROW { return qGetProp(ucs2); } -Q_CORE_EXPORT GraphemeBreakClass QT_FASTCALL graphemeBreakClass(uint ucs4) +Q_CORE_EXPORT GraphemeBreakClass QT_FASTCALL graphemeBreakClass(uint ucs4) Q_DECL_NOTHROW { return (GraphemeBreakClass)qGetProp(ucs4)->graphemeBreakClass; } -Q_CORE_EXPORT WordBreakClass QT_FASTCALL wordBreakClass(uint ucs4) +Q_CORE_EXPORT WordBreakClass QT_FASTCALL wordBreakClass(uint ucs4) Q_DECL_NOTHROW { return (WordBreakClass)qGetProp(ucs4)->wordBreakClass; } -Q_CORE_EXPORT SentenceBreakClass QT_FASTCALL sentenceBreakClass(uint ucs4) +Q_CORE_EXPORT SentenceBreakClass QT_FASTCALL sentenceBreakClass(uint ucs4) Q_DECL_NOTHROW { return (SentenceBreakClass)qGetProp(ucs4)->sentenceBreakClass; } -Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4) +Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4) Q_DECL_NOTHROW { return (LineBreakClass)qGetProp(ucs4)->lineBreakClass; } diff --git a/src/corelib/tools/qunicodetables_p.h b/src/corelib/tools/qunicodetables_p.h index 64e1ad12b5..34da53ac58 100644 --- a/src/corelib/tools/qunicodetables_p.h +++ b/src/corelib/tools/qunicodetables_p.h @@ -79,8 +79,8 @@ struct Properties { ushort script : 8; /* 7 used */ }; -Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4); -Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2); +Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) Q_DECL_NOTHROW; +Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) Q_DECL_NOTHROW; enum GraphemeBreakClass { GraphemeBreak_Other, @@ -147,20 +147,20 @@ enum LineBreakClass { LineBreak_BK }; -Q_CORE_EXPORT GraphemeBreakClass QT_FASTCALL graphemeBreakClass(uint ucs4); -inline GraphemeBreakClass graphemeBreakClass(QChar ch) +Q_CORE_EXPORT GraphemeBreakClass QT_FASTCALL graphemeBreakClass(uint ucs4) Q_DECL_NOTHROW; +inline GraphemeBreakClass graphemeBreakClass(QChar ch) Q_DECL_NOTHROW { return graphemeBreakClass(ch.unicode()); } -Q_CORE_EXPORT WordBreakClass QT_FASTCALL wordBreakClass(uint ucs4); -inline WordBreakClass wordBreakClass(QChar ch) +Q_CORE_EXPORT WordBreakClass QT_FASTCALL wordBreakClass(uint ucs4) Q_DECL_NOTHROW; +inline WordBreakClass wordBreakClass(QChar ch) Q_DECL_NOTHROW { return wordBreakClass(ch.unicode()); } -Q_CORE_EXPORT SentenceBreakClass QT_FASTCALL sentenceBreakClass(uint ucs4); -inline SentenceBreakClass sentenceBreakClass(QChar ch) +Q_CORE_EXPORT SentenceBreakClass QT_FASTCALL sentenceBreakClass(uint ucs4) Q_DECL_NOTHROW; +inline SentenceBreakClass sentenceBreakClass(QChar ch) Q_DECL_NOTHROW { return sentenceBreakClass(ch.unicode()); } -Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4); -inline LineBreakClass lineBreakClass(QChar ch) +Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4) Q_DECL_NOTHROW; +inline LineBreakClass lineBreakClass(QChar ch) Q_DECL_NOTHROW { return lineBreakClass(ch.unicode()); } } // namespace QUnicodeTables diff --git a/util/unicode/main.cpp b/util/unicode/main.cpp index 2ad9458eeb..2852310112 100644 --- a/util/unicode/main.cpp +++ b/util/unicode/main.cpp @@ -730,25 +730,25 @@ static const char *property_string = " ushort lineBreakClass : 8; /* 6 used */\n" " ushort script : 8; /* 7 used */\n" "};\n\n" - "Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4);\n" - "Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2);\n" + "Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) Q_DECL_NOTHROW;\n" + "Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) Q_DECL_NOTHROW;\n" "\n"; static const char *methods = - "Q_CORE_EXPORT GraphemeBreakClass QT_FASTCALL graphemeBreakClass(uint ucs4);\n" - "inline GraphemeBreakClass graphemeBreakClass(QChar ch)\n" + "Q_CORE_EXPORT GraphemeBreakClass QT_FASTCALL graphemeBreakClass(uint ucs4) Q_DECL_NOTHROW;\n" + "inline GraphemeBreakClass graphemeBreakClass(QChar ch) Q_DECL_NOTHROW\n" "{ return graphemeBreakClass(ch.unicode()); }\n" "\n" - "Q_CORE_EXPORT WordBreakClass QT_FASTCALL wordBreakClass(uint ucs4);\n" - "inline WordBreakClass wordBreakClass(QChar ch)\n" + "Q_CORE_EXPORT WordBreakClass QT_FASTCALL wordBreakClass(uint ucs4) Q_DECL_NOTHROW;\n" + "inline WordBreakClass wordBreakClass(QChar ch) Q_DECL_NOTHROW\n" "{ return wordBreakClass(ch.unicode()); }\n" "\n" - "Q_CORE_EXPORT SentenceBreakClass QT_FASTCALL sentenceBreakClass(uint ucs4);\n" - "inline SentenceBreakClass sentenceBreakClass(QChar ch)\n" + "Q_CORE_EXPORT SentenceBreakClass QT_FASTCALL sentenceBreakClass(uint ucs4) Q_DECL_NOTHROW;\n" + "inline SentenceBreakClass sentenceBreakClass(QChar ch) Q_DECL_NOTHROW\n" "{ return sentenceBreakClass(ch.unicode()); }\n" "\n" - "Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4);\n" - "inline LineBreakClass lineBreakClass(QChar ch)\n" + "Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4) Q_DECL_NOTHROW;\n" + "inline LineBreakClass lineBreakClass(QChar ch) Q_DECL_NOTHROW\n" "{ return lineBreakClass(ch.unicode()); }\n" "\n"; @@ -2393,44 +2393,44 @@ static QByteArray createPropertyInfo() out += "\n};\n\n"; - out += "Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(uint ucs4)\n" + out += "Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(uint ucs4) Q_DECL_NOTHROW\n" "{\n" " const int index = GET_PROP_INDEX(ucs4);\n" " return uc_properties + index;\n" "}\n" "\n" - "Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(ushort ucs2)\n" + "Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(ushort ucs2) Q_DECL_NOTHROW\n" "{\n" " const int index = GET_PROP_INDEX_UCS2(ucs2);\n" " return uc_properties + index;\n" "}\n" "\n" - "Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4)\n" + "Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) Q_DECL_NOTHROW\n" "{\n" " return qGetProp(ucs4);\n" "}\n" "\n" - "Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2)\n" + "Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) Q_DECL_NOTHROW\n" "{\n" " return qGetProp(ucs2);\n" "}\n\n"; - out += "Q_CORE_EXPORT GraphemeBreakClass QT_FASTCALL graphemeBreakClass(uint ucs4)\n" + out += "Q_CORE_EXPORT GraphemeBreakClass QT_FASTCALL graphemeBreakClass(uint ucs4) Q_DECL_NOTHROW\n" "{\n" " return (GraphemeBreakClass)qGetProp(ucs4)->graphemeBreakClass;\n" "}\n" "\n" - "Q_CORE_EXPORT WordBreakClass QT_FASTCALL wordBreakClass(uint ucs4)\n" + "Q_CORE_EXPORT WordBreakClass QT_FASTCALL wordBreakClass(uint ucs4) Q_DECL_NOTHROW\n" "{\n" " return (WordBreakClass)qGetProp(ucs4)->wordBreakClass;\n" "}\n" "\n" - "Q_CORE_EXPORT SentenceBreakClass QT_FASTCALL sentenceBreakClass(uint ucs4)\n" + "Q_CORE_EXPORT SentenceBreakClass QT_FASTCALL sentenceBreakClass(uint ucs4) Q_DECL_NOTHROW\n" "{\n" " return (SentenceBreakClass)qGetProp(ucs4)->sentenceBreakClass;\n" "}\n" "\n" - "Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4)\n" + "Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4) Q_DECL_NOTHROW\n" "{\n" " return (LineBreakClass)qGetProp(ucs4)->lineBreakClass;\n" "}\n"