summaryrefslogtreecommitdiffstats
path: root/util/unicode/main.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-06-30 14:34:39 -0700
committerThiago Macieira <thiago.macieira@intel.com>2014-07-07 03:51:43 +0200
commit2fe90a61bdf16bb1a08817ba544e2309b524a052 (patch)
treec9537f8d981d27c04221e8957f9fed4726123f99 /util/unicode/main.cpp
parent11c30f9705e796ebabcdd868bce3ad3664cc06eb (diff)
Mark all QChar static functions as [[gnu::const]]
The GCC documentation says that a const function is not allowed to read global memory. This needs to be clarified: it's not allowed to read RW global memory. It's fine to read read-only memory, as that is equivalent to just pure code. The QChar static out-of-line functions only lookup a property of the given Unicode character and always return the same value. The only exception is the decomposition() function, which returns a QString and is therefore not allowed to be marked const. Change-Id: Id36b2f84a1b8ff9db5acf1d4e59e8b3811068cff Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'util/unicode/main.cpp')
-rw-r--r--util/unicode/main.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/util/unicode/main.cpp b/util/unicode/main.cpp
index 4f941d0eb3..0747238b8e 100644
--- a/util/unicode/main.cpp
+++ b/util/unicode/main.cpp
@@ -2401,24 +2401,24 @@ static QByteArray createPropertyInfo()
out += "\n};\n\n";
- out += "static inline const Properties *qGetProp(uint ucs4)\n"
+ out += "Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(uint ucs4)\n"
"{\n"
" const int index = GET_PROP_INDEX(ucs4);\n"
" return uc_properties + index;\n"
"}\n"
"\n"
- "static inline const Properties *qGetProp(ushort ucs2)\n"
+ "Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(ushort ucs2)\n"
"{\n"
" const int index = GET_PROP_INDEX_UCS2(ucs2);\n"
" return uc_properties + index;\n"
"}\n"
"\n"
- "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)\n"
"{\n"
" return qGetProp(ucs4);\n"
"}\n"
"\n"
- "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)\n"
"{\n"
" return qGetProp(ucs2);\n"
"}\n\n";