From 08ef4d232df82c056d4f5fda636b62b65fc054ad Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 29 Oct 2024 11:01:31 +0100 Subject: [PATCH] Make static constexpr data tables inline in corelib/t*/q*_data_p.h This should keep gcc from complaining that they're unused const variables. Pick-to: 6.8 Fixes: QTBUG-128930 Change-Id: I4d0bccc5f158dfc72e4cf38a085b90cb562dc185 Reviewed-by: Thiago Macieira --- src/corelib/text/qlocale_data_p.h | 60 ++++++++++------------ src/corelib/time/qhijricalendar_data_p.h | 9 +--- src/corelib/time/qjalalicalendar_data_p.h | 9 +--- src/corelib/time/qromancalendar_data_p.h | 9 +--- src/corelib/time/qtimezonelocale_data_p.h | 28 +++++----- src/corelib/time/qtimezoneprivate_data_p.h | 27 ++++------ util/locale_database/qlocalexml2cpp.py | 42 +++++++-------- 7 files changed, 78 insertions(+), 106 deletions(-) diff --git a/src/corelib/text/qlocale_data_p.h b/src/corelib/text/qlocale_data_p.h index 556398f27e6..661d8cf0710 100644 --- a/src/corelib/text/qlocale_data_p.h +++ b/src/corelib/text/qlocale_data_p.h @@ -36,16 +36,13 @@ struct TerritoryLanguage QLocale::MeasurementSystem system; }; -QT_WARNING_PUSH // QTBUG-128930 -QT_WARNING_DISABLE_CLANG("-Wunused-const-variable") -static constexpr TerritoryLanguage ImperialMeasurementSystems[] = { +static inline constexpr TerritoryLanguage ImperialMeasurementSystems[] = { { QLocale::English, QLocale::UnitedStates, QLocale::ImperialUSSystem }, { QLocale::English, QLocale::UnitedStatesMinorOutlyingIslands, QLocale::ImperialUSSystem }, { QLocale::Spanish, QLocale::UnitedStates, QLocale::ImperialUSSystem }, { QLocale::Hawaiian, QLocale::UnitedStates, QLocale::ImperialUSSystem }, { QLocale::English, QLocale::UnitedKingdom, QLocale::ImperialUKSystem } }; -QT_WARNING_POP // QTBUG-128930 /* Storage for alpha codes with length of up to 4 allowing efficient comparison. @@ -61,8 +58,8 @@ struct AlphaCode { std::array decode() const { return {m2c(c1), m2c(c2), m2c(c3), 0}; } private: - static constexpr uint16_t c2m(char c) { return c ? c - 'a' + 1 : 0; } - static constexpr char m2c (uint16_t c) { return c ? c + 'a' - 1 : 0; } + static inline constexpr uint16_t c2m(char c) { return c ? c - 'a' + 1 : 0; } + static inline constexpr char m2c (uint16_t c) { return c ? c + 'a' - 1 : 0; } friend bool operator==(AlphaCode lhs, AlphaCode rhs) noexcept { @@ -80,9 +77,6 @@ struct LanguageCodeEntry { AlphaCode part3; }; -QT_WARNING_PUSH // QTBUG-128930 -QT_WARNING_DISABLE_CLANG("-Wunused-const-variable") - // GENERATED PART STARTS HERE /* @@ -96,7 +90,7 @@ QT_WARNING_DISABLE_CLANG("-Wunused-const-variable") edited) CLDR data; see qtbase/util/locale_database/. */ -static constexpr QLocaleId likely_subtags[] = { +static inline constexpr QLocaleId likely_subtags[] = { { 2, 0, 0 }, { 2, 27, 90 }, // ab -> ab_Cyrl_GE { 3, 0, 0 }, { 3, 66, 77 }, // aa -> aa_Latn_ET { 4, 0, 0 }, { 4, 66, 216 }, // af -> af_Latn_ZA @@ -1060,7 +1054,7 @@ static constexpr QLocaleId likely_subtags[] = { { 0, 142, 0 }, { 339, 142, 161 }, // und_Rohg -> rhg_Rohg_MM }; -static constexpr quint16 locale_index[] = { +static inline constexpr quint16 locale_index[] = { 0, // AnyLanguage 0, // C 1, // Abkhazian @@ -1409,7 +1403,7 @@ static constexpr quint16 locale_index[] = { 0 // trailing 0 }; -static constexpr QLocaleData locale_data[] = { +static inline constexpr QLocaleData locale_data[] = { // lang script terr lStrt lpMid lpEnd lPair lDelm dec group prcnt zero minus plus exp qtOpn qtEnd altQO altQE lDFmt sDFmt lTFmt sTFmt slDay lDays ssDys sDays snDay nDays am pm byte siQnt iecQn crSym crDsp crFmt crFNg ntLng ntTer currISO curDgt curRnd dow1st wknd+ wknd- grpTop grpMid grpEnd { 1, 0, 0, 0, 0, 0, 0, 6, 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 8, 0, 17, 0, 0, 0, 0, 56, 56, 83, 96, 0, 0, 0, 5, 22, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 17, 10, 10, 8, 56, 56, 27, 27, 13, 13, 2, 2, 5, 17, 23, 0, 0, 4, 0, 0, 0, {0,0,0}, 2, 1, 1, 6, 7, 1, 3, 3 }, // C/AnyScript/AnyTerritory { 2, 27, 90, 0, 0, 7, 7, 6, 1, 9, 2, 3, 4, 5, 10, 11, 12, 13, 14, 27, 49, 10, 0, 109, 109, 157, 157, 179, 179, 0, 0, 0, 5, 22, 0, 0, 4, 0, 0, 6, 6, 6, 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 22, 10, 13, 5, 48, 48, 22, 22, 15, 15, 2, 2, 4, 17, 23, 1, 0, 5, 0, 6, 9, {71,69,76}, 2, 1, 1, 6, 7, 1, 3, 3 }, // Abkhazian/Cyrillic/Georgia @@ -2087,7 +2081,7 @@ static constexpr QLocaleData locale_data[] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0,0,0}, 0, 0, 0, 0, 0, 0, 0, 0 } // trailing zeros }; -static constexpr char16_t list_pattern_part_data[] = { +static inline constexpr char16_t list_pattern_part_data[] = { 0x25, 0x31, 0x2c, 0x20, 0x25, 0x32, 0x3b, 0x25, 0x31, 0x2d, 0x438, 0x20, 0x25, 0x32, 0x2d, 0x438, 0x25, 0x31, 0x20, 0x65, 0x6e, 0x20, 0x25, 0x32, 0x25, 0x31, 0x20, 0x25, 0x32, 0x25, 0x31, 0x20, 0x64, 0x68, 0x65, 0x20, @@ -2206,7 +2200,7 @@ static constexpr char16_t list_pattern_part_data[] = { 0x32 }; -static constexpr char16_t single_character_data[] = { +static inline constexpr char16_t single_character_data[] = { 0x2e, 0x2c, 0x25, 0x30, 0x2d, 0x2b, 0x65, 0x22, 0x27, 0xa0, 0x45, 0xab, 0xbb, 0x201e, 0x201c, 0x201d, 0x2018, 0x2019, 0x201a, 0x2039, 0x203a, 0x66b, 0x66c, 0x66a, 0x61c, 0x660, 0x61c, 0x2d, 0x61c, 0x2b, 0x623, 0x633, 0x200e, 0x25, 0x200e, 0x200e, @@ -2217,7 +2211,7 @@ static constexpr char16_t single_character_data[] = { 0x1c50, 0x415 }; -static constexpr char16_t date_format_data[] = { +static inline constexpr char16_t date_format_data[] = { 0x64, 0x64, 0x64, 0x64, 0x2c, 0x20, 0x64, 0x20, 0x4d, 0x4d, 0x4d, 0x4d, 0x20, 0x79, 0x79, 0x79, 0x79, 0x64, 0x20, 0x4d, 0x4d, 0x4d, 0x20, 0x79, 0x79, 0x79, 0x79, 0x64, 0x64, 0x64, 0x64, 0x2c, 0x20, 0x64, 0x20, 0x4d, @@ -2403,7 +2397,7 @@ static constexpr char16_t date_format_data[] = { 0x79, 0x79 }; -static constexpr char16_t time_format_data[] = { +static inline constexpr char16_t time_format_data[] = { 0x48, 0x48, 0x3a, 0x6d, 0x6d, 0x3a, 0x73, 0x73, 0x20, 0x74, 0x48, 0x48, 0x3a, 0x6d, 0x6d, 0x3a, 0x73, 0x73, 0x20, 0x74, 0x74, 0x74, 0x74, 0x68, 0x3a, 0x6d, 0x6d, 0x3a, 0x73, 0x73, 0x202f, 0x41, 0x70, 0x20, 0x74, 0x74, @@ -2457,7 +2451,7 @@ static constexpr char16_t time_format_data[] = { 0x6d, 0x20, 0x27, 0x68, 0x6f, 0x64, 0x17a, 0x27, 0x2e }; -static constexpr char16_t days_data[] = { +static inline constexpr char16_t days_data[] = { 0x53, 0x75, 0x6e, 0x64, 0x61, 0x79, 0x3b, 0x4d, 0x6f, 0x6e, 0x64, 0x61, 0x79, 0x3b, 0x54, 0x75, 0x65, 0x73, 0x64, 0x61, 0x79, 0x3b, 0x57, 0x65, 0x64, 0x6e, 0x65, 0x73, 0x64, 0x61, 0x79, 0x3b, 0x54, 0x68, 0x75, 0x72, @@ -4819,7 +4813,7 @@ static constexpr char16_t days_data[] = { 0xc35, 0xc30, 0xc3e }; -static constexpr char16_t byte_unit_data[] = { +static inline constexpr char16_t byte_unit_data[] = { 0x62, 0x79, 0x74, 0x65, 0x73, 0x6b, 0x42, 0x3b, 0x4d, 0x42, 0x3b, 0x47, 0x42, 0x3b, 0x54, 0x42, 0x3b, 0x50, 0x42, 0x3b, 0x45, 0x42, 0x4b, 0x69, 0x42, 0x3b, 0x4d, 0x69, 0x42, 0x3b, 0x47, 0x69, 0x42, 0x3b, 0x54, 0x69, @@ -4938,7 +4932,7 @@ static constexpr char16_t byte_unit_data[] = { 0x69, 0x74, 0x61 }; -static constexpr char16_t am_data[] = { +static inline constexpr char16_t am_data[] = { 0x41, 0x4d, 0x76, 0x6d, 0x2e, 0x61, 0x2e, 0x67, 0x41, 0x4e, 0x65, 0x20, 0x70, 0x61, 0x72, 0x61, 0x64, 0x69, 0x74, 0x65, 0x73, 0x1325, 0x12cb, 0x1275, 0x635, 0x9aa, 0x9c2, 0x9f0, 0x9cd, 0x9ac, 0x9be, 0x9b9, 0x9cd, 0x9a8, 0x64, 0x65, @@ -5017,7 +5011,7 @@ static constexpr char16_t am_data[] = { 0x20, 0xc0e, 0xc2e, 0xc4d }; -static constexpr char16_t pm_data[] = { +static inline constexpr char16_t pm_data[] = { 0x50, 0x4d, 0x6e, 0x6d, 0x2e, 0x61, 0x2e, 0x6b, 0x45, 0x57, 0x65, 0x20, 0x70, 0x61, 0x73, 0x64, 0x69, 0x74, 0x65, 0x73, 0x12a8, 0x1230, 0x12d3, 0x1275, 0x645, 0x985, 0x9aa, 0x9f0, 0x9be, 0x9b9, 0x9cd, 0x9a8, 0x64, 0x65, 0x20, 0x6c, @@ -5100,7 +5094,7 @@ static constexpr char16_t pm_data[] = { 0xc0e, 0xc2e, 0xc4d }; -static constexpr char16_t currency_symbol_data[] = { +static inline constexpr char16_t currency_symbol_data[] = { 0x20be, 0x42, 0x72, 0x46, 0x64, 0x6a, 0x4e, 0x66, 0x6b, 0x52, 0x24, 0x46, 0x43, 0x46, 0x41, 0x47, 0x48, 0x20b5, 0x4c, 0x65, 0x6b, 0xeb, 0x20ac, 0x64, 0x65, 0x6e, 0x1265, 0x122d, 0x62c, 0x2e, 0x645, 0x2e, 0x200f, 0x62f, 0x2e, 0x62c, @@ -5130,7 +5124,7 @@ static constexpr char16_t currency_symbol_data[] = { 0x2e, 0x4e, 0x54, 0x24, 0xe3f, 0x73, 0x6f, 0x2bb, 0x6d, 0x441, 0x45e, 0x43c }; -static constexpr char16_t currency_display_name_data[] = { +static inline constexpr char16_t currency_display_name_data[] = { 0x53, 0x75, 0x69, 0x64, 0x2d, 0x41, 0x66, 0x72, 0x69, 0x6b, 0x61, 0x61, 0x6e, 0x73, 0x65, 0x20, 0x72, 0x61, 0x6e, 0x64, 0x4e, 0x61, 0x6d, 0x69, 0x62, 0x69, 0x65, 0x73, 0x65, 0x20, 0x64, 0x6f, 0x6c, 0x6c, 0x61, 0x72, @@ -5615,7 +5609,7 @@ static constexpr char16_t currency_display_name_data[] = { 0x72, 0x61, 0x74, 0x20, 0x74, 0x69, 0x20, 0x1e6d, 0x6e, 0x6b, 0x101 }; -static constexpr char16_t currency_format_data[] = { +static inline constexpr char16_t currency_format_data[] = { 0x25, 0x31, 0x25, 0x32, 0x25, 0x31, 0xa0, 0x25, 0x32, 0x28, 0x25, 0x32, 0x25, 0x31, 0x29, 0x25, 0x32, 0xa0, 0x25, 0x31, 0x28, 0x25, 0x31, 0xa0, 0x25, 0x32, 0x29, 0x200f, 0x25, 0x31, 0xa0, 0x25, 0x32, 0x61c, 0x25, 0x31, @@ -5629,7 +5623,7 @@ static constexpr char16_t currency_format_data[] = { 0x25, 0x32 }; -static constexpr char16_t endonyms_data[] = { +static inline constexpr char16_t endonyms_data[] = { 0x410, 0x525, 0x441, 0x448, 0x4d9, 0x430, 0x49a, 0x44b, 0x440, 0x4ad, 0x442, 0x4d9, 0x44b, 0x43b, 0x430, 0x51, 0x61, 0x66, 0x61, 0x72, 0x4f, 0x74, 0x6f, 0x62, 0x62, 0x69, 0x61, 0x59, 0x61, 0x62, 0x75, 0x75, 0x74, 0x69, 0x45, 0x72, @@ -6238,7 +6232,7 @@ static constexpr char16_t endonyms_data[] = { 0xc26, 0xc46, 0xc38, 0xc3e, 0xc02 }; -static constexpr char language_name_list[] = +static inline constexpr char language_name_list[] = "Default\0" "C\0" "Abkhazian\0" @@ -6586,7 +6580,7 @@ static constexpr char language_name_list[] = "Kuvi\0" ; -static constexpr quint16 language_name_index[] = { +static inline constexpr quint16 language_name_index[] = { 0, // AnyLanguage 8, // C 10, // Abkhazian @@ -7282,7 +7276,7 @@ constexpr std::array languageCodeList { LanguageCodeEntry {{}, {}, {}, {'k', 'x', 'v'}}, // Kuvi }; -static constexpr char script_name_list[] = +static inline constexpr char script_name_list[] = "Default\0" "Adlam\0" "Ahom\0" @@ -7428,7 +7422,7 @@ static constexpr char script_name_list[] = "Hanifi Rohingya\0" ; -static constexpr quint16 script_name_index[] = { +static inline constexpr quint16 script_name_index[] = { 0, // AnyScript 8, // Adlam 14, // Ahom @@ -7574,7 +7568,7 @@ static constexpr quint16 script_name_index[] = { 1361, // Hanifi }; -static constexpr unsigned char script_code_list[] = +static inline constexpr unsigned char script_code_list[] = "Zzzz" // AnyScript "Adlm" // Adlam "Ahom" // Ahom @@ -7720,7 +7714,7 @@ static constexpr unsigned char script_code_list[] = "Rohg" // Hanifi ; -static constexpr char territory_name_list[] = +static inline constexpr char territory_name_list[] = "Default\0" "Afghanistan\0" "Ă…land Islands\0" @@ -7985,7 +7979,7 @@ static constexpr char territory_name_list[] = "Zimbabwe\0" ; -static constexpr quint16 territory_name_index[] = { +static inline constexpr quint16 territory_name_index[] = { 0, // AnyTerritory 8, // Afghanistan 20, // Aland Islands @@ -8250,7 +8244,7 @@ static constexpr quint16 territory_name_index[] = { 2836, // Zimbabwe }; -static constexpr unsigned char territory_code_list[] = +static inline constexpr unsigned char territory_code_list[] = "ZZ\0" // AnyTerritory "AF\0" // Afghanistan "AX\0" // Aland Islands @@ -8517,8 +8511,6 @@ static constexpr unsigned char territory_code_list[] = // GENERATED PART ENDS HERE -QT_WARNING_POP // QTBUG-128930 - QT_END_NAMESPACE #endif diff --git a/src/corelib/time/qhijricalendar_data_p.h b/src/corelib/time/qhijricalendar_data_p.h index 34ccdeca1ce..cbf0b7c46a0 100644 --- a/src/corelib/time/qhijricalendar_data_p.h +++ b/src/corelib/time/qhijricalendar_data_p.h @@ -23,9 +23,6 @@ QT_BEGIN_NAMESPACE namespace QtPrivate::Hijri { -QT_WARNING_PUSH // QTBUG-128930 -QT_WARNING_DISABLE_CLANG("-Wunused-const-variable") - // GENERATED PART STARTS HERE /* @@ -39,7 +36,7 @@ QT_WARNING_DISABLE_CLANG("-Wunused-const-variable") edited) CLDR data; see qtbase/util/locale_database/. */ -static constexpr QCalendarLocale locale_data[] = { +static inline constexpr QCalendarLocale locale_data[] = { // lang script terr sLong long sShrt short sNarw narow Sizes... { 1, 0, 0, 0, 0, 106, 106, 184, 184,106,106, 78, 78, 26, 26 },// C/AnyScript/AnyTerritory { 2, 27, 90, 0, 0, 106, 106, 184, 184,106,106, 78, 78, 26, 26 },// Abkhazian/Cyrillic/Georgia @@ -717,7 +714,7 @@ static constexpr QCalendarLocale locale_data[] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },// trailing zeros }; -static constexpr char16_t months_data[] = { +static inline constexpr char16_t months_data[] = { 0x4d, 0x75, 0x68, 0x61, 0x72, 0x72, 0x61, 0x6d, 0x3b, 0x53, 0x61, 0x66, 0x61, 0x72, 0x3b, 0x52, 0x61, 0x62, 0x69, 0x2bb, 0x20, 0x49, 0x3b, 0x52, 0x61, 0x62, 0x69, 0x2bb, 0x20, 0x49, 0x49, 0x3b, 0x4a, 0x75, 0x6d, 0x61, @@ -1794,8 +1791,6 @@ static constexpr char16_t months_data[] = { }; // GENERATED PART ENDS HERE -QT_WARNING_POP // QTBUG-128930 - } // namespace QtPrivate::Hijri QT_END_NAMESPACE diff --git a/src/corelib/time/qjalalicalendar_data_p.h b/src/corelib/time/qjalalicalendar_data_p.h index a270b393777..edce9536fda 100644 --- a/src/corelib/time/qjalalicalendar_data_p.h +++ b/src/corelib/time/qjalalicalendar_data_p.h @@ -23,9 +23,6 @@ QT_BEGIN_NAMESPACE namespace QtPrivate::Jalali { -QT_WARNING_PUSH // QTBUG-128930 -QT_WARNING_DISABLE_CLANG("-Wunused-const-variable") - // GENERATED PART STARTS HERE /* @@ -39,7 +36,7 @@ QT_WARNING_DISABLE_CLANG("-Wunused-const-variable") edited) CLDR data; see qtbase/util/locale_database/. */ -static constexpr QCalendarLocale locale_data[] = { +static inline constexpr QCalendarLocale locale_data[] = { // lang script terr sLong long sShrt short sNarw narow Sizes... { 1, 0, 0, 0, 0, 83, 83, 130, 153, 83, 83, 47, 47, 23, 26 },// C/AnyScript/AnyTerritory { 2, 27, 90, 0, 0, 0, 0, 153, 153, 83, 83, 83, 83, 26, 26 },// Abkhazian/Cyrillic/Georgia @@ -717,7 +714,7 @@ static constexpr QCalendarLocale locale_data[] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },// trailing zeros }; -static constexpr char16_t months_data[] = { +static inline constexpr char16_t months_data[] = { 0x46, 0x61, 0x72, 0x76, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x3b, 0x4f, 0x72, 0x64, 0x69, 0x62, 0x65, 0x68, 0x65, 0x73, 0x68, 0x74, 0x3b, 0x4b, 0x68, 0x6f, 0x72, 0x64, 0x61, 0x64, 0x3b, 0x54, 0x69, 0x72, 0x3b, 0x4d, 0x6f, @@ -1169,8 +1166,6 @@ static constexpr char16_t months_data[] = { }; // GENERATED PART ENDS HERE -QT_WARNING_POP // QTBUG-128930 - } // namespace QtPrivate::Jalali QT_END_NAMESPACE diff --git a/src/corelib/time/qromancalendar_data_p.h b/src/corelib/time/qromancalendar_data_p.h index 5fbf29cd9cf..1b69d06fbf3 100644 --- a/src/corelib/time/qromancalendar_data_p.h +++ b/src/corelib/time/qromancalendar_data_p.h @@ -23,9 +23,6 @@ QT_BEGIN_NAMESPACE namespace QtPrivate::Roman { -QT_WARNING_PUSH // QTBUG-128930 -QT_WARNING_DISABLE_CLANG("-Wunused-const-variable") - // GENERATED PART STARTS HERE /* @@ -39,7 +36,7 @@ QT_WARNING_DISABLE_CLANG("-Wunused-const-variable") edited) CLDR data; see qtbase/util/locale_database/. */ -static constexpr QCalendarLocale locale_data[] = { +static inline constexpr QCalendarLocale locale_data[] = { // lang script terr sLong long sShrt short sNarw narow Sizes... { 1, 0, 0, 0, 0, 85, 85, 132, 155, 85, 85, 47, 47, 23, 26 },// C/AnyScript/AnyTerritory { 2, 27, 90, 181, 181, 278, 278, 336, 364, 97, 97, 58, 58, 28, 28 },// Abkhazian/Cyrillic/Georgia @@ -717,7 +714,7 @@ static constexpr QCalendarLocale locale_data[] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },// trailing zeros }; -static constexpr char16_t months_data[] = { +static inline constexpr char16_t months_data[] = { 0x4a, 0x61, 0x6e, 0x75, 0x61, 0x72, 0x79, 0x3b, 0x46, 0x65, 0x62, 0x72, 0x75, 0x61, 0x72, 0x79, 0x3b, 0x4d, 0x61, 0x72, 0x63, 0x68, 0x3b, 0x41, 0x70, 0x72, 0x69, 0x6c, 0x3b, 0x4d, 0x61, 0x79, 0x3b, 0x4a, 0x75, 0x6e, @@ -5139,8 +5136,6 @@ static constexpr char16_t months_data[] = { }; // GENERATED PART ENDS HERE -QT_WARNING_POP // QTBUG-128930 - } // namespace QtPrivate::Roman QT_END_NAMESPACE diff --git a/src/corelib/time/qtimezonelocale_data_p.h b/src/corelib/time/qtimezonelocale_data_p.h index 8ed89fb4b1e..1fbd51a7b54 100644 --- a/src/corelib/time/qtimezonelocale_data_p.h +++ b/src/corelib/time/qtimezonelocale_data_p.h @@ -70,7 +70,7 @@ namespace QtTimeZoneLocale { */ // Sorted by locale index, then iana name -static constexpr LocaleZoneExemplar localeZoneExemplarTable[] = { +static inline constexpr LocaleZoneExemplar localeZoneExemplarTable[] = { // locInd, ianaInd, xcty{ind, sz} { 0, 14, 0, 6, }, // Africa/Asmara C/AnyScript/AnyTerritory { 0, 4337, 6, 8, }, // Africa/Sao_Tome @@ -47845,7 +47845,7 @@ static constexpr LocaleZoneExemplar localeZoneExemplarTable[] = { }; // Exemplar city table // Sorted by locale index, then iana name -static constexpr LocaleZoneNames localeZoneNameTable[] = { +static inline constexpr LocaleZoneNames localeZoneNameTable[] = { // locInd, ianaInd, (lngGen, lngStd, lngDst, srtGen, srtStd, srtDst){ind, sz} { 0, 2347, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 3, 0, }, // Etc/UTC C/AnyScript/AnyTerritory { 0, 2260, 0, 0, 26, 0, 0, 0, 0, 0, 19, 0, 0, 0, }, // Europe/Dublin @@ -48630,7 +48630,7 @@ static constexpr LocaleZoneNames localeZoneNameTable[] = { }; // Zone naming table // Sorted by locale index, then meta key -static constexpr LocaleMetaZoneLongNames localeMetaZoneLongNameTable[] = { +static inline constexpr LocaleMetaZoneLongNames localeMetaZoneLongNameTable[] = { // locInd, metaKey, (generic, standard, DST){ind, sz} { 0, 0, 0, 9, 27, 9, 18, 16, }, // Acre C/AnyScript/AnyTerritory { 0, 5, 0, 43, 0, 0, 16, 0, }, // Afghanistan @@ -73892,7 +73892,7 @@ static constexpr LocaleMetaZoneLongNames localeMetaZoneLongNameTable[] = { }; // Metazone long name table // Sorted by locale index, then meta key -static constexpr LocaleMetaZoneShortNames localeMetaZoneShortNameTable[] = { +static inline constexpr LocaleMetaZoneShortNames localeMetaZoneShortNameTable[] = { // locInd, metaKey, (generic, standard, DST){ind, sz} { 0, 107, 0, 3, 7, 3, 4, 4, }, // Alaska C/AnyScript/AnyTerritory { 0, 142, 11, 13, 16, 2, 3, 3, }, // America_Central @@ -75313,7 +75313,7 @@ static constexpr LocaleMetaZoneShortNames localeMetaZoneShortNameTable[] = { }; // Metazone short name table // Indexing matches that of locale_data in qlocale_data_p.h -static constexpr LocaleZoneData localeZoneData[] = { +static inline constexpr LocaleZoneData localeZoneData[] = { // LOCALE_TAGS(lng,scp,ter) xct1st, zn1st, ml1st, ms1st, (+hr, -hr, gmt, flbk, rgen, rstd, rdst){ind,sz} { LOCALE_TAGS( 1, 0, 0) 0, 0, 0, 0, 0, 6, 0, 0, 0, 7, 23, 6, 6, 5, 7, 7, 16, 16, }, // C/AnyScript/AnyTerritory { LOCALE_TAGS( 2, 27, 90) 42, 158, 8, 4, 0, 6, 0, 0, 39, 47, 66, 6, 6, 5, 7, 8, 19, 17, }, // Abkhazian/Cyrillic/Georgia @@ -75991,7 +75991,7 @@ static constexpr LocaleZoneData localeZoneData[] = { { LOCALE_TAGS( 0, 0, 0) 47770, 25257, 1416, 780, 88, 88, 271, 49, 6066, 6066, 6066, 0, 0, 0, 0, 0, 0, 0, } // Terminal row }; // Locale/zone data -static constexpr char16_t hourFormatTable[] = { +static inline constexpr char16_t hourFormatTable[] = { 0x2b, 0x48, 0x48, 0x3a, 0x6d, 0x6d, 0x2d, 0x48, 0x48, 0x3a, 0x6d, 0x6d, 0x2b, 0x48, 0x48, 0x6d, 0x6d, 0x2d, 0x48, 0x48, 0x6d, 0x6d, 0x2212, 0x48, 0x48, 0x3a, 0x6d, 0x6d, 0x20, 0x2d, 0x48, 0x48, 0x3a, 0x6d, 0x6d, 0x2b, @@ -76002,7 +76002,7 @@ static constexpr char16_t hourFormatTable[] = { 0x48, 0x3a, 0x6d, 0x6d }; -static constexpr char16_t gmtFormatTable[] = { +static inline constexpr char16_t gmtFormatTable[] = { 0x47, 0x4d, 0x54, 0x25, 0x30, 0x1302, 0x20, 0x12a4, 0x121d, 0x20, 0x1272, 0x25, 0x30, 0x63a, 0x631, 0x64a, 0x646, 0x62a, 0x634, 0x25, 0x30, 0x47, 0x4d, 0x54, 0x20, 0x25, 0x30, 0x91c, 0x93f, 0x2e, 0x90f, 0x92e, 0x2e, 0x924, 0x93f, 0x20, @@ -76028,7 +76028,7 @@ static constexpr char16_t gmtFormatTable[] = { 0x970, 0x20, 0x91f, 0x948, 0x970, 0x25, 0x30 }; -static constexpr char16_t regionFormatTable[] = { +static inline constexpr char16_t regionFormatTable[] = { 0x25, 0x30, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x25, 0x30, 0x20, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x25, 0x30, 0x20, 0x44, 0x61, 0x79, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x20, 0x54, @@ -76537,7 +76537,7 @@ static constexpr char16_t regionFormatTable[] = { 0xb1f, 0x20, 0xb2c, 0xb47, 0xb32, 0xb3e }; -static constexpr char16_t fallbackFormatTable[] = { +static inline constexpr char16_t fallbackFormatTable[] = { 0x25, 0x31, 0x20, 0x28, 0x25, 0x30, 0x29, 0x25, 0x31, 0x20, 0x25, 0x30, 0x25, 0x31, 0xff08, 0x25, 0x30, 0xff09, 0x25, 0x31, 0xf0d, 0x20, 0x28, 0x25, 0x30, 0xf0b, 0x29, 0x5b, 0x25, 0x31, 0x20, 0x28, 0x25, 0x30, 0x29, 0x5d, @@ -76545,7 +76545,7 @@ static constexpr char16_t fallbackFormatTable[] = { 0x29 }; -static constexpr char16_t exemplarCityTable[] = { +static inline constexpr char16_t exemplarCityTable[] = { 0x41, 0x73, 0x6d, 0x61, 0x72, 0x61, 0x53, 0xe3, 0x6f, 0x20, 0x54, 0x6f, 0x6d, 0xe9, 0x41, 0x73, 0x75, 0x6e, 0x63, 0x69, 0xf3, 0x6e, 0x41, 0x74, 0x69, 0x6b, 0x6f, 0x6b, 0x61, 0x6e, 0x42, 0x61, 0x68, 0xed, 0x61, 0x20, @@ -94435,7 +94435,7 @@ static constexpr char16_t exemplarCityTable[] = { 0x69, 0x73 }; -static constexpr char16_t shortZoneNameTable[] = { +static inline constexpr char16_t shortZoneNameTable[] = { 0x55, 0x54, 0x43, 0x48, 0x53, 0x54, 0x48, 0x44, 0x54, 0x2205, 0x2205, 0x2205, 0x49, 0x53, 0x54, 0x42, 0x53, 0x54, 0x54, 0x55, 0x48, 0x54, 0xd83a, 0xdd11, 0xd83a, 0xdd16, 0xd83a, 0xdd0a, 0xd83a, 0xdd11, 0xd83a, 0xdd16, 0xd83a, 0xdd16, 0xd83a, 0xdd11, @@ -94452,7 +94452,7 @@ static constexpr char16_t shortZoneNameTable[] = { 0x189, 0x41, 0x4b }; -static constexpr char16_t longZoneNameTable[] = { +static inline constexpr char16_t longZoneNameTable[] = { 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x64, 0x20, 0x55, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x61, 0x6c, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x49, 0x72, 0x69, 0x73, 0x68, 0x20, 0x53, 0x74, 0x61, 0x6e, @@ -95251,7 +95251,7 @@ static constexpr char16_t longZoneNameTable[] = { 0x72, 0xe3, 0x20, 0x6d, 0x61, 0x73, 0x61, 0x20, 0x62, 0x65, 0x6c, 0x101 }; -static constexpr char16_t shortMetaZoneNameTable[] = { +static inline constexpr char16_t shortMetaZoneNameTable[] = { 0x41, 0x4b, 0x54, 0x41, 0x4b, 0x53, 0x54, 0x41, 0x4b, 0x44, 0x54, 0x43, 0x54, 0x43, 0x53, 0x54, 0x43, 0x44, 0x54, 0x45, 0x54, 0x45, 0x53, 0x54, 0x45, 0x44, 0x54, 0x4d, 0x54, 0x4d, 0x53, 0x54, 0x4d, 0x44, 0x54, 0x50, @@ -95325,7 +95325,7 @@ static constexpr char16_t shortMetaZoneNameTable[] = { 0x51, 0x47, 0x47, 0x6b }; -static constexpr char16_t longMetaZoneNameTable[] = { +static inline constexpr char16_t longMetaZoneNameTable[] = { 0x41, 0x63, 0x72, 0x65, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x41, 0x63, 0x72, 0x65, 0x20, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x41, 0x63, 0x72, 0x65, 0x20, 0x53, 0x75, 0x6d, 0x6d, diff --git a/src/corelib/time/qtimezoneprivate_data_p.h b/src/corelib/time/qtimezoneprivate_data_p.h index b90e1d4847f..ab900563cc8 100644 --- a/src/corelib/time/qtimezoneprivate_data_p.h +++ b/src/corelib/time/qtimezoneprivate_data_p.h @@ -123,9 +123,6 @@ struct ZoneMetaHistory }; #endif // timezone_locale but not ICU -QT_WARNING_PUSH // QTBUG-128930 -QT_WARNING_DISABLE_CLANG("-Wunused-const-variable") - // GENERATED PART STARTS HERE /* @@ -140,7 +137,7 @@ QT_WARNING_DISABLE_CLANG("-Wunused-const-variable") */ // IANA ID indices of alias and IANA ID -static constexpr AliasData aliasMappingTable[] = { +static inline constexpr AliasData aliasMappingTable[] = { { 0, 14 }, // Africa/Asmera -> Africa/Asmara { 28, 44 }, // Africa/Timbuktu -> Africa/Bamako { 58, 91 }, // America/Argentina/ComodRivadavia -> America/Argentina/Catamarca @@ -288,7 +285,7 @@ static constexpr AliasData aliasMappingTable[] = { }; // Windows ID Key, Territory Enum, IANA List Index -static constexpr ZoneData zoneDataTable[] = { +static inline constexpr ZoneData zoneDataTable[] = { { 1, 1, 0 }, // Afghanistan Standard Time / Afghanistan { 2, 248, 11 }, // Alaskan Standard Time / United States { 3, 248, 106 }, // Aleutian Standard Time / United States @@ -657,7 +654,7 @@ static constexpr ZoneData zoneDataTable[] = { }; // Windows ID Key, Windows ID Index, IANA ID Index, UTC Offset -static constexpr WindowsData windowsDataTable[] = { +static inline constexpr WindowsData windowsDataTable[] = { { 1, 0, 3462, 16200 }, // Afghanistan Standard Time { 2, 26, 3183,-32400 }, // Alaskan Standard Time { 3, 48, 132,-36000 }, // Aleutian Standard Time @@ -800,7 +797,7 @@ static constexpr WindowsData windowsDataTable[] = { }; // IANA List Index, UTC Offset -static constexpr UtcData utcDataTable[] = { +static inline constexpr UtcData utcDataTable[] = { { 7184,-50400 }, // UTC-14:00 { 7194,-46800 }, // UTC-13:00 { 7204,-43200 }, // UTC-12:00 @@ -848,7 +845,7 @@ static constexpr UtcData utcDataTable[] = { #if QT_CONFIG(timezone_locale) && !QT_CONFIG(icu) // QLocale::Territory value, IANA ID Index -static constexpr TerritoryZone territoryZoneMap[] = { +static inline constexpr TerritoryZone territoryZoneMap[] = { { 49, 2165 }, // Chile -> America/Santiago { 50, 1020 }, // China -> Asia/Shanghai { 70, 4743 }, // Ecuador -> America/Guayaquil @@ -863,7 +860,7 @@ static constexpr TerritoryZone territoryZoneMap[] = { }; // MetaZone Key, MetaZone Name Index, QLocale::Territory value, IANA ID Index -static constexpr MetaZoneData metaZoneTable[] = { +static inline constexpr MetaZoneData metaZoneTable[] = { { 1, 0, 258, 695 }, // Acre/world -> America/Rio_Branco { 2, 5, 258, 3462 }, // Afghanistan/world -> Asia/Kabul { 3, 17, 30, 4808 }, // Africa_Central/Botswana -> Africa/Gaborone @@ -1188,7 +1185,7 @@ static constexpr MetaZoneData metaZoneTable[] = { }; // IANA ID Index, MetaZone Key, interval start, end -static constexpr ZoneMetaHistory zoneHistoryTable[] = { +static inline constexpr ZoneMetaHistory zoneHistoryTable[] = { { 6751, 76, 0,4294967295 }, { 6723, 76, 0,4294967295 }, { 4961, 4, 0,4294967295 }, @@ -1865,7 +1862,7 @@ static constexpr ZoneMetaHistory zoneHistoryTable[] = { #endif // timezone_locale but not ICU -static constexpr char windowsIdData[] = { +static inline constexpr char windowsIdData[] = { 0x41, 0x66, 0x67, 0x68, 0x61, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x20, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x0, 0x41, 0x6c, 0x61, 0x73, 0x6b, 0x61, 0x6e, 0x20, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x0, @@ -2070,7 +2067,7 @@ static constexpr char windowsIdData[] = { 0x6d, 0x65, 0x0 }; -static constexpr char ianaListData[] = { +static inline constexpr char ianaListData[] = { 0x41, 0x73, 0x69, 0x61, 0x2f, 0x4b, 0x61, 0x62, 0x75, 0x6c, 0x0, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x4a, 0x75, 0x6e, 0x65, 0x61, 0x75, 0x20, 0x41, 0x6d, 0x65, 0x72, @@ -2550,7 +2547,7 @@ static constexpr char ianaListData[] = { 0x30, 0x0 }; -static constexpr char ianaIdData[] = { +static inline constexpr char ianaIdData[] = { 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x73, 0x6d, 0x65, 0x72, 0x61, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x41, 0x73, 0x6d, 0x61, 0x72, 0x61, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x2f, 0x54, 0x69, 0x6d, 0x62, 0x75, 0x6b, 0x74, 0x75, 0x0, 0x41, 0x66, 0x72, 0x69, @@ -3114,7 +3111,7 @@ static constexpr char ianaIdData[] = { #if QT_CONFIG(timezone_locale) && !QT_CONFIG(icu) -static constexpr char metaIdData[] = { +static inline constexpr char metaIdData[] = { 0x41, 0x63, 0x72, 0x65, 0x0, 0x41, 0x66, 0x67, 0x68, 0x61, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x5f, 0x43, 0x65, 0x6e, 0x74, 0x72, 0x61, 0x6c, 0x0, 0x41, 0x66, 0x72, 0x69, 0x63, 0x61, 0x5f, 0x45, 0x61, 0x73, 0x74, 0x65, 0x72, 0x6e, 0x0, 0x41, @@ -3240,8 +3237,6 @@ static constexpr char metaIdData[] = { // GENERATED PART ENDS HERE -QT_WARNING_POP // QTBUG-128930 - constexpr QByteArrayView AliasData::aliasId() const { return ianaIdData + aliasIdIndex; } constexpr QByteArrayView AliasData::ianaId() const { return ianaIdData + ianaIdIndex; } #if QT_CONFIG(timezone_locale) && !QT_CONFIG(icu) diff --git a/util/locale_database/qlocalexml2cpp.py b/util/locale_database/qlocalexml2cpp.py index b235fd7d10b..b51e95930c4 100755 --- a/util/locale_database/qlocalexml2cpp.py +++ b/util/locale_database/qlocalexml2cpp.py @@ -89,7 +89,7 @@ class ByteArrayData: return index def write(self, out: Callable[[str], int], name: str) -> None: - out(f'\nstatic constexpr char {name}[] = {{\n') + out(f'\nstatic inline constexpr char {name}[] = {{\n') out(wrap_list(self.data, 16)) # 16 == 100 // len('0xhh, ') # All data is ASCII, so only two-digit hex is ever needed. out('\n};\n') @@ -163,7 +163,7 @@ class StringData: raise ValueError(f'Data is too big ({len(self.data)}) ' f'for {indbits}-bit index to its end!', self.name) - out(f"\nstatic constexpr char16_t {self.name}[] = {{\n") + out(f"\nstatic inline constexpr char16_t {self.name}[] = {{\n") out(wrap_list(self.data, 12)) # 12 == 100 // len('0xhhhh, ') out("\n};\n") @@ -219,7 +219,7 @@ class TimeZoneDataWriter (LocaleSourceEditor): # Write UTC ID key table out('\n// IANA List Index, UTC Offset\n') - out('static constexpr UtcData utcDataTable[] = {\n') + out('static inline constexpr UtcData utcDataTable[] = {\n') for offset in sorted(offsetMap.keys()): # Sort so C++ can binary-chop. names: tuple[str, ...] = offsetMap[offset] joined: int = self.__ianaListTable.append(' '.join(names)) @@ -231,7 +231,7 @@ class TimeZoneDataWriter (LocaleSourceEditor): store: Callable[[str], int] = self.__ianaTable.append out('// IANA ID indices of alias and IANA ID\n') - out('static constexpr AliasData aliasMappingTable[] = {\n') + out('static inline constexpr AliasData aliasMappingTable[] = {\n') for name, iana in pairs: # They're ready-sorted assert name != iana, (name, iana) # Filtered out in QLocaleXmlWriter out(f' {{ {store(name):6d},{store(iana):6d} }},' @@ -248,7 +248,7 @@ class TimeZoneDataWriter (LocaleSourceEditor): for code, iana in pairs) # Write territory-to-zone table out('\n// QLocale::Territory value, IANA ID Index\n') - out('static constexpr TerritoryZone territoryZoneMap[] = {\n') + out('static inline constexpr TerritoryZone territoryZoneMap[] = {\n') # Sorted by QLocale::Territory value: for land, iana, terra in seq: out(f' {{ {land:6d},{store(iana):6d} }}, // {terra} -> {iana}\n') @@ -269,7 +269,7 @@ class TimeZoneDataWriter (LocaleSourceEditor): # Write (metazone, territory, zone) table out('\n// MetaZone Key, MetaZone Name Index, ' 'QLocale::Territory value, IANA ID Index\n') - out('static constexpr MetaZoneData metaZoneTable[] = {\n') + out('static inline constexpr MetaZoneData metaZoneTable[] = {\n') # Sorted by metaKey, then by QLocale::Territory within each metazone: for mkey, land, meta, terra, iana in seq: out(f' {{ {mkey:6d},{metaStore(meta):6d},{land:6d},{ianaStore(iana):6d} }},' @@ -286,7 +286,7 @@ class TimeZoneDataWriter (LocaleSourceEditor): # Write (zone, metazone key, begin, end) table: out('\n// IANA ID Index, MetaZone Key, interval start, end\n') - out('static constexpr ZoneMetaHistory zoneHistoryTable[] = {\n') + out('static inline constexpr ZoneMetaHistory zoneHistoryTable[] = {\n') # Sorted by IANA ID; each story comes pre-sorted on (start, stop) for iana, start, stop, mkey in quads: out(f' {{ {store(iana):6d},{mkey:6d},{start:10d},{stop:10d} }},\n') @@ -302,7 +302,7 @@ class TimeZoneDataWriter (LocaleSourceEditor): assert all(not any(x.isspace() for x in iana) for iana in alias.values()) out('\n// Windows ID Key, Windows ID Index, IANA ID Index, UTC Offset\n') - out('static constexpr WindowsData windowsDataTable[] = {\n') + out('static inline constexpr WindowsData windowsDataTable[] = {\n') # Sorted by Windows ID key: for index, (name, offset) in enumerate(self.__windowsList, 1): @@ -320,7 +320,7 @@ class TimeZoneDataWriter (LocaleSourceEditor): for name, land, ianas in triples) out('// Windows ID Key, Territory Enum, IANA List Index\n') - out('static constexpr ZoneData zoneDataTable[] = {\n') + out('static inline constexpr ZoneData zoneDataTable[] = {\n') # Sorted by (Windows ID Key, territory enum) for winId, landId, name, land, ianas in seq: out(f' {{ {winId:6d},{landId:6d},{store(ianas):6d} }},' @@ -404,7 +404,7 @@ class LocaleZoneDataWriter (LocaleSourceEditor): out: Callable[[str], int] = self.writer.write out('// Sorted by locale index, then iana name\n') - out('static constexpr LocaleZoneExemplar localeZoneExemplarTable[] = {\n') + out('static inline constexpr LocaleZoneExemplar localeZoneExemplarTable[] = {\n') out(' // locInd, ianaInd, xcty{ind, sz}\n') store: Callable[[str], StringDataToken] = self.__exemplarCityTable.append formatLine: Callable[[*tuple[int, ...]], str] = ''.join(( @@ -431,7 +431,7 @@ class LocaleZoneDataWriter (LocaleSourceEditor): exemplarRowCount: int = index out('\n// Sorted by locale index, then iana name\n') - out('static constexpr LocaleZoneNames localeZoneNameTable[] = {\n') + out('static inline constexpr LocaleZoneNames localeZoneNameTable[] = {\n') out(' // locInd, ianaInd, (lngGen, lngStd, lngDst,' ' srtGen, srtStd, srtDst){ind, sz}\n') longStore: Callable[[str], StringDataToken] = self.__longZoneNameTable.append @@ -474,7 +474,7 @@ class LocaleZoneDataWriter (LocaleSourceEditor): # saving. out('\n// Sorted by locale index, then meta key\n') - out('static constexpr LocaleMetaZoneLongNames localeMetaZoneLongNameTable[] = {\n') + out('static inline constexpr LocaleMetaZoneLongNames localeMetaZoneLongNameTable[] = {\n') out(' // locInd, metaKey, (generic, standard, DST){ind, sz}\n') store = self.__longMetaZoneNameTable.append formatLine = ''.join(( @@ -510,7 +510,7 @@ class LocaleZoneDataWriter (LocaleSourceEditor): metaLongCount: int = index out('\n// Sorted by locale index, then meta key\n') - out('static constexpr LocaleMetaZoneShortNames localeMetaZoneShortNameTable[] = {\n') + out('static inline constexpr LocaleMetaZoneShortNames localeMetaZoneShortNameTable[] = {\n') out(' // locInd, metaKey, (generic, standard, DST){ind, sz}\n') store = self.__shortMetaZoneNameTable.append formatLine = ''.join(( @@ -546,7 +546,7 @@ class LocaleZoneDataWriter (LocaleSourceEditor): metaShortCount: int = index out('\n// Indexing matches that of locale_data in qlocale_data_p.h\n') - out('static constexpr LocaleZoneData localeZoneData[] = {\n') + out('static inline constexpr LocaleZoneData localeZoneData[] = {\n') out(' // LOCALE_TAGS(lng,scp,ter) xct1st, zn1st, ml1st, ms1st, ' '(+hr, -hr, gmt, flbk, rgen, rstd, rdst){ind,sz}\n') hour: StringData = self.__hourFormatTable @@ -605,7 +605,7 @@ class LocaleZoneDataWriter (LocaleSourceEditor): class LocaleDataWriter (LocaleSourceEditor): def likelySubtags(self, likely: Iterator[tuple[str, tuple, str, tuple]]) -> None: # Sort order of likely is taken care of upstream. - self.writer.write('static constexpr QLocaleId likely_subtags[] = {\n') + self.writer.write('static inline constexpr QLocaleId likely_subtags[] = {\n') # have and give are both triplets of ints for had, have, got, give in likely: self.writer.write(' {{ {:3d}, {:3d}, {:3d} }}'.format(*have)) @@ -614,7 +614,7 @@ class LocaleDataWriter (LocaleSourceEditor): self.writer.write('};\n\n') def localeIndex(self, indices: Iterator[tuple[int, str]]) -> None: - self.writer.write('static constexpr quint16 locale_index[] = {\n') + self.writer.write('static inline constexpr quint16 locale_index[] = {\n') for index, name in indices: self.writer.write(f'{index:6d}, // {name}\n') self.writer.write(' 0 // trailing 0\n') @@ -636,7 +636,7 @@ class LocaleDataWriter (LocaleSourceEditor): endonyms_data = StringData('endonyms_data') # Locale data - self.writer.write('static constexpr QLocaleData locale_data[] = {\n') + self.writer.write('static inline constexpr QLocaleData locale_data[] = {\n') # Table headings: keep each label centred in its field, matching line_format: self.writer.write(' // ' # Width 6 + comma @@ -787,7 +787,7 @@ class LocaleDataWriter (LocaleSourceEditor): @staticmethod def __writeNameData(out, book: dict[int, tuple[str, str, str]], form: str) -> None: - out(f'static constexpr char {form}_name_list[] =\n') + out(f'static inline constexpr char {form}_name_list[] =\n') out('"Default\\0"\n') for key, value in book.items(): if key == 0: @@ -799,7 +799,7 @@ class LocaleDataWriter (LocaleSourceEditor): out(f'"{name}\\0"\n') # Automagically utf-8 encoded out(';\n\n') - out(f'static constexpr quint16 {form}_name_index[] = {{\n') + out(f'static inline constexpr quint16 {form}_name_index[] = {{\n') out(f' 0, // Any{form.capitalize()}\n') index = 8 for key, value in book.items(): @@ -811,7 +811,7 @@ class LocaleDataWriter (LocaleSourceEditor): @staticmethod def __writeCodeList(out, book: dict[int, tuple[str, str, str]], form: str, width: int) -> None: - out(f'static constexpr unsigned char {form}_code_list[] =\n') + out(f'static inline constexpr unsigned char {form}_code_list[] =\n') for key, value in book.items(): code = value[1] code += r'\0' * max(width - len(code), 0) @@ -864,7 +864,7 @@ class CalendarDataWriter (LocaleSourceEditor): names: list[tuple[int, int, int]]) -> None: months_data = StringData('months_data', 16) - self.writer.write('static constexpr QCalendarLocale locale_data[] = {\n') + self.writer.write('static inline constexpr QCalendarLocale locale_data[] = {\n') self.writer.write( ' //' # IDs, width 7 (6 + comma)