From 3b9c0b42c333767edf39d1ddba03dbd73be5fe3c Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Wed, 27 Mar 2024 13:30:43 -0700 Subject: [PATCH] ICU-22261 Add UCONFIG_NO_MF2 flag that can be used to disable MessageFormat 2 functionality --- .github/workflows/icu4c.yml | 18 ++++++++++-------- icu4c/source/common/unicode/uconfig.h | 11 +++++++++++ icu4c/source/i18n/messageformat2.cpp | 4 ++++ icu4c/source/i18n/messageformat2_allocation.h | 4 ++++ icu4c/source/i18n/messageformat2_arguments.cpp | 4 ++++ .../i18n/messageformat2_cached_formatters.h | 4 ++++ icu4c/source/i18n/messageformat2_checker.cpp | 4 ++++ icu4c/source/i18n/messageformat2_checker.h | 4 ++++ .../source/i18n/messageformat2_data_model.cpp | 4 ++++ icu4c/source/i18n/messageformat2_errors.cpp | 4 ++++ icu4c/source/i18n/messageformat2_errors.h | 4 ++++ .../source/i18n/messageformat2_evaluation.cpp | 4 ++++ icu4c/source/i18n/messageformat2_evaluation.h | 4 ++++ .../source/i18n/messageformat2_formattable.cpp | 4 ++++ icu4c/source/i18n/messageformat2_formatter.cpp | 4 ++++ .../i18n/messageformat2_function_registry.cpp | 4 ++++ ...messageformat2_function_registry_internal.h | 4 ++++ icu4c/source/i18n/messageformat2_macros.h | 4 ++++ icu4c/source/i18n/messageformat2_parser.cpp | 4 ++++ icu4c/source/i18n/messageformat2_parser.h | 4 ++++ .../source/i18n/messageformat2_serializer.cpp | 4 ++++ icu4c/source/i18n/messageformat2_serializer.h | 4 ++++ icu4c/source/i18n/unicode/messageformat2.h | 4 ++++ .../i18n/unicode/messageformat2_arguments.h | 4 ++++ .../i18n/unicode/messageformat2_data_model.h | 4 ++++ .../unicode/messageformat2_data_model_names.h | 4 ++++ .../i18n/unicode/messageformat2_formattable.h | 4 ++++ .../unicode/messageformat2_function_registry.h | 4 ++++ icu4c/source/test/intltest/itformat.cpp | 2 ++ .../test/intltest/messageformat2test.cpp | 4 ++++ .../source/test/intltest/messageformat2test.h | 4 ++++ .../intltest/messageformat2test_builtin.cpp | 4 ++++ .../intltest/messageformat2test_custom.cpp | 4 ++++ .../intltest/messageformat2test_features.cpp | 4 ++++ .../intltest/messageformat2test_fromjson.cpp | 5 +++++ .../test/intltest/messageformat2test_icu.cpp | 4 ++++ .../test/intltest/messageformat2test_utils.h | 8 ++++++-- 37 files changed, 162 insertions(+), 10 deletions(-) diff --git a/.github/workflows/icu4c.yml b/.github/workflows/icu4c.yml index c2b10cb7f464..3509ccdb65fe 100644 --- a/.github/workflows/icu4c.yml +++ b/.github/workflows/icu4c.yml @@ -367,20 +367,21 @@ jobs: - "-DUCONFIG_NO_IDNA=1" - "-DUCONFIG_NO_COLLATION=1" - "-DUCONFIG_NO_FORMATTING=1" + - "-DUCONFIG_NO_MF2=1" - "-DUCONFIG_NO_TRANSLITERATION=1" - "-DUCONFIG_NO_REGULAR_EXPRESSIONS=1" - "-DUCONFIG_NO_SERVICE=1" - "-DUCONFIG_NO_FILTERED_BREAK_ITERATION=1" # Turn on all the options in one test. - - "-DUCONFIG_NO_LEGACY_CONVERSION=1 -DUCONFIG_NO_NORMALIZATION=1 -DUCONFIG_NO_BREAK_ITERATION=1 -DUCONFIG_NO_IDNA=1 -DUCONFIG_NO_COLLATION=1 -DUCONFIG_NO_FORMATTING=1 -DUCONFIG_NO_TRANSLITERATION=1 -DUCONFIG_NO_REGULAR_EXPRESSIONS=1 -DUCONFIG_NO_SERVICE=1 -DUCONFIG_NO_FILTERED_BREAK_ITERATION=1" + - "-DUCONFIG_NO_LEGACY_CONVERSION=1 -DUCONFIG_NO_NORMALIZATION=1 -DUCONFIG_NO_BREAK_ITERATION=1 -DUCONFIG_NO_IDNA=1 -DUCONFIG_NO_COLLATION=1 -DUCONFIG_NO_FORMATTING=1 -DUCONFIG_NO_MF2=1 -DUCONFIG_NO_TRANSLITERATION=1 -DUCONFIG_NO_REGULAR_EXPRESSIONS=1 -DUCONFIG_NO_SERVICE=1 -DUCONFIG_NO_FILTERED_BREAK_ITERATION=1" steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Verify no additional new UCONFIG_NO_xxx added run: | - # Test that we have exactly 12 "#ifndef UCONFIG_NO_" in uconfig.h. If the number changes, we need to also - # adjust the uconfig_cppflags above to include the new one and update the "12" below. - expected_count="12"; + # Test that we have exactly 13 "#ifndef UCONFIG_NO_" in uconfig.h. If the number changes, we need to also + # adjust the uconfig_cppflags above to include the new one and update the "13" below. + expected_count="13"; count=`egrep "#ifndef UCONFIG_NO_" icu4c/source/common/unicode/uconfig.h| wc -l`; if [ $expected_count != $count ]; then echo "More than %s UCONFIG_NO_* defined in uconfig.h, please adjust uconfig_cppflags above to include any newly added flag" % $expected_count; @@ -413,21 +414,22 @@ jobs: - "-DUCONFIG_NO_IDNA=1" - "-DUCONFIG_NO_COLLATION=1" - "-DUCONFIG_NO_FORMATTING=1" + - "-DUCONFIG_NO_MF2=1" - "-DUCONFIG_NO_TRANSLITERATION=1" - "-DUCONFIG_NO_REGULAR_EXPRESSIONS=1" - "-DUCONFIG_NO_SERVICE=1" - "-DUCONFIG_NO_FILTERED_BREAK_ITERATION=1" # Turn on all the options in one test. - - "-DUCONFIG_NO_LEGACY_CONVERSION=1 -DUCONFIG_NO_NORMALIZATION=1 -DUCONFIG_NO_BREAK_ITERATION=1 -DUCONFIG_NO_IDNA=1 -DUCONFIG_NO_COLLATION=1 -DUCONFIG_NO_FORMATTING=1 -DUCONFIG_NO_TRANSLITERATION=1 -DUCONFIG_NO_REGULAR_EXPRESSIONS=1 -DUCONFIG_NO_SERVICE=1 -DUCONFIG_NO_FILTERED_BREAK_ITERATION=1" + - "-DUCONFIG_NO_LEGACY_CONVERSION=1 -DUCONFIG_NO_NORMALIZATION=1 -DUCONFIG_NO_BREAK_ITERATION=1 -DUCONFIG_NO_IDNA=1 -DUCONFIG_NO_COLLATION=1 -DUCONFIG_NO_FORMATTING=1 -DUCONFIG_NO_MF2=1 -DUCONFIG_NO_TRANSLITERATION=1 -DUCONFIG_NO_REGULAR_EXPRESSIONS=1 -DUCONFIG_NO_SERVICE=1 -DUCONFIG_NO_FILTERED_BREAK_ITERATION=1" steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Verify no additional new UCONFIG_NO_xxx added run: | - # Test that we have exactly 12 "#ifndef UCONFIG_NO_" in uconfig.h. If the number changes, we need to also - # adjust the uconfig_cppflags above to include the new one and update the "12" below. + # Test that we have exactly 13 "#ifndef UCONFIG_NO_" in uconfig.h. If the number changes, we need to also + # adjust the uconfig_cppflags above to include the new one and update the "13" below. count=`egrep "#ifndef UCONFIG_NO_" icu4c/source/common/unicode/uconfig.h| wc -l`; - if [ "12" != $count ]; then + if [ "13" != $count ]; then echo "More than %s UCONFIG_NO_* defined in uconfig.h, please adjust uconfig_cppflags above to include any newly added flag" % $count; echo "Currently UCONFIG_NO_* defined in uconfig.h:"; egrep "#ifndef UCONFIG_NO_" icu4c/source/common/unicode/uconfig.h; diff --git a/icu4c/source/common/unicode/uconfig.h b/icu4c/source/common/unicode/uconfig.h index 3818ca02ef85..1bd97071fbe4 100644 --- a/icu4c/source/common/unicode/uconfig.h +++ b/icu4c/source/common/unicode/uconfig.h @@ -413,6 +413,17 @@ # define UCONFIG_NO_FORMATTING 0 #endif +/** + * \def UCONFIG_NO_MF2 + * This switch turns off the experimental MessageFormat 2.0 API. + * + * @internal ICU 75.0 technology preview + * @deprecated This API is for technology preview only. + */ +#ifndef UCONFIG_NO_MF2 +# define UCONFIG_NO_MF2 0 +#endif + /** * \def UCONFIG_NO_TRANSLITERATION * This switch turns off transliteration. diff --git a/icu4c/source/i18n/messageformat2.cpp b/icu4c/source/i18n/messageformat2.cpp index 8d9efe6d62cb..1c5b7bb23a52 100644 --- a/icu4c/source/i18n/messageformat2.cpp +++ b/icu4c/source/i18n/messageformat2.cpp @@ -5,6 +5,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/messageformat2_arguments.h" #include "unicode/messageformat2_data_model.h" #include "unicode/messageformat2_formattable.h" @@ -871,4 +873,6 @@ void MessageFormatter::checkDeclarations(MessageContext& context, Environment*& U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/messageformat2_allocation.h b/icu4c/source/i18n/messageformat2_allocation.h index 566206d79f30..a0d4d1db513c 100644 --- a/icu4c/source/i18n/messageformat2_allocation.h +++ b/icu4c/source/i18n/messageformat2_allocation.h @@ -10,6 +10,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/unistr.h" #include "uvector.h" @@ -129,6 +131,8 @@ namespace message2 { U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/icu4c/source/i18n/messageformat2_arguments.cpp b/icu4c/source/i18n/messageformat2_arguments.cpp index ac2d2365b406..ded3f4dda160 100644 --- a/icu4c/source/i18n/messageformat2_arguments.cpp +++ b/icu4c/source/i18n/messageformat2_arguments.cpp @@ -5,6 +5,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/messageformat2_arguments.h" #include "unicode/messageformat2_data_model_names.h" #include "uvector.h" // U_ASSERT @@ -52,4 +54,6 @@ namespace message2 { U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/messageformat2_cached_formatters.h b/icu4c/source/i18n/messageformat2_cached_formatters.h index 1c83441369c7..33b24d07648a 100644 --- a/icu4c/source/i18n/messageformat2_cached_formatters.h +++ b/icu4c/source/i18n/messageformat2_cached_formatters.h @@ -10,6 +10,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/messageformat2_data_model_names.h" #include "unicode/messageformat2_function_registry.h" #include "hash.h" @@ -52,6 +54,8 @@ namespace message2 { U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/icu4c/source/i18n/messageformat2_checker.cpp b/icu4c/source/i18n/messageformat2_checker.cpp index 9c384a505136..192167583fff 100644 --- a/icu4c/source/i18n/messageformat2_checker.cpp +++ b/icu4c/source/i18n/messageformat2_checker.cpp @@ -5,6 +5,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "messageformat2_allocation.h" #include "messageformat2_checker.h" #include "messageformat2_macros.h" @@ -292,4 +294,6 @@ void Checker::check(UErrorCode& status) { } // namespace message2 U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/messageformat2_checker.h b/icu4c/source/i18n/messageformat2_checker.h index ffb617b67a7f..38de91c3756c 100644 --- a/icu4c/source/i18n/messageformat2_checker.h +++ b/icu4c/source/i18n/messageformat2_checker.h @@ -10,6 +10,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/messageformat2_data_model.h" #include "messageformat2_errors.h" @@ -80,6 +82,8 @@ namespace message2 { U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/icu4c/source/i18n/messageformat2_data_model.cpp b/icu4c/source/i18n/messageformat2_data_model.cpp index 19574ada4341..b29f29e81342 100644 --- a/icu4c/source/i18n/messageformat2_data_model.cpp +++ b/icu4c/source/i18n/messageformat2_data_model.cpp @@ -5,6 +5,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/messageformat2_data_model.h" #include "messageformat2_allocation.h" #include "messageformat2_macros.h" @@ -1095,4 +1097,6 @@ MFDataModel::Builder::~Builder() { U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/messageformat2_errors.cpp b/icu4c/source/i18n/messageformat2_errors.cpp index 3fad5f882ea6..48fa17a79ad8 100644 --- a/icu4c/source/i18n/messageformat2_errors.cpp +++ b/icu4c/source/i18n/messageformat2_errors.cpp @@ -5,6 +5,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "messageformat2_allocation.h" #include "messageformat2_errors.h" #include "messageformat2_macros.h" @@ -283,4 +285,6 @@ namespace message2 { U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/messageformat2_errors.h b/icu4c/source/i18n/messageformat2_errors.h index 3e36dfe51322..522adc1be86e 100644 --- a/icu4c/source/i18n/messageformat2_errors.h +++ b/icu4c/source/i18n/messageformat2_errors.h @@ -15,6 +15,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/messageformat2_data_model_names.h" #include "unicode/utypes.h" #include "unicode/unistr.h" @@ -145,6 +147,8 @@ namespace message2 { U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/icu4c/source/i18n/messageformat2_evaluation.cpp b/icu4c/source/i18n/messageformat2_evaluation.cpp index 25f3c945069f..a735521f5bbf 100644 --- a/icu4c/source/i18n/messageformat2_evaluation.cpp +++ b/icu4c/source/i18n/messageformat2_evaluation.cpp @@ -5,6 +5,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "messageformat2_allocation.h" #include "messageformat2_cached_formatters.h" #include "messageformat2_evaluation.h" @@ -205,4 +207,6 @@ PrioritizedVariant::~PrioritizedVariant() {} } // namespace message2 U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/messageformat2_evaluation.h b/icu4c/source/i18n/messageformat2_evaluation.h index 853f397fb6c5..e9ecb23c2568 100644 --- a/icu4c/source/i18n/messageformat2_evaluation.h +++ b/icu4c/source/i18n/messageformat2_evaluation.h @@ -15,6 +15,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/messageformat2_arguments.h" #include "unicode/messageformat2_data_model.h" #include "unicode/messageformat2_function_registry.h" @@ -193,6 +195,8 @@ namespace message2 { U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/icu4c/source/i18n/messageformat2_formattable.cpp b/icu4c/source/i18n/messageformat2_formattable.cpp index 42fb25b48fd8..3152ccb44fd8 100644 --- a/icu4c/source/i18n/messageformat2_formattable.cpp +++ b/icu4c/source/i18n/messageformat2_formattable.cpp @@ -5,6 +5,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/messageformat2_formattable.h" #include "unicode/smpdtfmt.h" #include "messageformat2_macros.h" @@ -331,4 +333,6 @@ namespace message2 { U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/messageformat2_formatter.cpp b/icu4c/source/i18n/messageformat2_formatter.cpp index 603969019cf6..a54a9a97e9d5 100644 --- a/icu4c/source/i18n/messageformat2_formatter.cpp +++ b/icu4c/source/i18n/messageformat2_formatter.cpp @@ -5,6 +5,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/messageformat2.h" #include "messageformat2_allocation.h" #include "messageformat2_cached_formatters.h" @@ -350,4 +352,6 @@ namespace message2 { U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/messageformat2_function_registry.cpp b/icu4c/source/i18n/messageformat2_function_registry.cpp index c844c479b08c..18401d4844c7 100644 --- a/icu4c/source/i18n/messageformat2_function_registry.cpp +++ b/icu4c/source/i18n/messageformat2_function_registry.cpp @@ -5,6 +5,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/dtptngen.h" #include "unicode/messageformat2_data_model_names.h" #include "unicode/messageformat2_function_registry.h" @@ -1178,5 +1180,7 @@ StandardFunctions::TextSelector::~TextSelector() {} } // namespace message2 U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/messageformat2_function_registry_internal.h b/icu4c/source/i18n/messageformat2_function_registry_internal.h index 1ba757a30e81..72ef17ceda7f 100644 --- a/icu4c/source/i18n/messageformat2_function_registry_internal.h +++ b/icu4c/source/i18n/messageformat2_function_registry_internal.h @@ -10,6 +10,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/datefmt.h" #include "unicode/messageformat2_function_registry.h" @@ -217,6 +219,8 @@ namespace message2 { U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/icu4c/source/i18n/messageformat2_macros.h b/icu4c/source/i18n/messageformat2_macros.h index 35687507f983..8efa45432f5c 100644 --- a/icu4c/source/i18n/messageformat2_macros.h +++ b/icu4c/source/i18n/messageformat2_macros.h @@ -12,6 +12,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/format.h" #include "unicode/unistr.h" #include "plurrule_impl.h" @@ -99,6 +101,8 @@ static constexpr UChar32 ID_MATCH[] = { } // namespace message2 U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/icu4c/source/i18n/messageformat2_parser.cpp b/icu4c/source/i18n/messageformat2_parser.cpp index 2b81e49da119..1e3995fea979 100644 --- a/icu4c/source/i18n/messageformat2_parser.cpp +++ b/icu4c/source/i18n/messageformat2_parser.cpp @@ -5,6 +5,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "messageformat2_errors.h" #include "messageformat2_macros.h" #include "messageformat2_parser.h" @@ -2429,5 +2431,7 @@ Parser::~Parser() {} } // namespace message2 U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/messageformat2_parser.h b/icu4c/source/i18n/messageformat2_parser.h index 1c707c04eb90..3dc45e19a9a7 100644 --- a/icu4c/source/i18n/messageformat2_parser.h +++ b/icu4c/source/i18n/messageformat2_parser.h @@ -16,6 +16,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + U_NAMESPACE_BEGIN namespace message2 { @@ -138,6 +140,8 @@ namespace message2 { U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/icu4c/source/i18n/messageformat2_serializer.cpp b/icu4c/source/i18n/messageformat2_serializer.cpp index efb2a9787425..b55c55ab7ced 100644 --- a/icu4c/source/i18n/messageformat2_serializer.cpp +++ b/icu4c/source/i18n/messageformat2_serializer.cpp @@ -5,6 +5,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/messageformat2_data_model.h" #include "messageformat2_macros.h" #include "messageformat2_serializer.h" @@ -332,5 +334,7 @@ void Serializer::serialize() { } // namespace message2 U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/i18n/messageformat2_serializer.h b/icu4c/source/i18n/messageformat2_serializer.h index 3b75c399ca55..d6c7eb5c47d7 100644 --- a/icu4c/source/i18n/messageformat2_serializer.h +++ b/icu4c/source/i18n/messageformat2_serializer.h @@ -10,6 +10,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/messageformat2_data_model.h" U_NAMESPACE_BEGIN @@ -58,6 +60,8 @@ namespace message2 { U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/icu4c/source/i18n/unicode/messageformat2.h b/icu4c/source/i18n/unicode/messageformat2.h index e43601973bd7..1d693cec25b6 100644 --- a/icu4c/source/i18n/unicode/messageformat2.h +++ b/icu4c/source/i18n/unicode/messageformat2.h @@ -10,6 +10,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + /** * \file * \brief C++ API: Formats messages using the draft MessageFormat 2.0. @@ -397,6 +399,8 @@ U_NAMESPACE_END #endif // U_HIDE_DEPRECATED_API +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/icu4c/source/i18n/unicode/messageformat2_arguments.h b/icu4c/source/i18n/unicode/messageformat2_arguments.h index c1690056552e..f70ca59badde 100644 --- a/icu4c/source/i18n/unicode/messageformat2_arguments.h +++ b/icu4c/source/i18n/unicode/messageformat2_arguments.h @@ -10,6 +10,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + /** * \file * \brief C++ API: Formats messages using the draft MessageFormat 2.0. @@ -134,6 +136,8 @@ U_NAMESPACE_END #endif // U_HIDE_DEPRECATED_API +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/icu4c/source/i18n/unicode/messageformat2_data_model.h b/icu4c/source/i18n/unicode/messageformat2_data_model.h index bd79ff556333..e472d001f3e8 100644 --- a/icu4c/source/i18n/unicode/messageformat2_data_model.h +++ b/icu4c/source/i18n/unicode/messageformat2_data_model.h @@ -10,6 +10,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/localpointer.h" #include "unicode/messageformat2_data_model_names.h" @@ -3070,6 +3072,8 @@ U_NAMESPACE_END #endif // U_HIDE_DEPRECATED_API +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/icu4c/source/i18n/unicode/messageformat2_data_model_names.h b/icu4c/source/i18n/unicode/messageformat2_data_model_names.h index 1568e125bf1c..fb3070793223 100644 --- a/icu4c/source/i18n/unicode/messageformat2_data_model_names.h +++ b/icu4c/source/i18n/unicode/messageformat2_data_model_names.h @@ -10,6 +10,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/unistr.h" #ifndef U_HIDE_DEPRECATED_API @@ -28,6 +30,8 @@ U_NAMESPACE_END #endif // U_HIDE_DEPRECATED_API +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/icu4c/source/i18n/unicode/messageformat2_formattable.h b/icu4c/source/i18n/unicode/messageformat2_formattable.h index 7f864199ae6c..0a83f260ad3e 100644 --- a/icu4c/source/i18n/unicode/messageformat2_formattable.h +++ b/icu4c/source/i18n/unicode/messageformat2_formattable.h @@ -10,6 +10,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/chariter.h" #include "unicode/numberformatter.h" #include "unicode/messageformat2_data_model_names.h" @@ -1006,6 +1008,8 @@ U_NAMESPACE_END #endif // U_HIDE_DEPRECATED_API +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/icu4c/source/i18n/unicode/messageformat2_function_registry.h b/icu4c/source/i18n/unicode/messageformat2_function_registry.h index eab7da9ec6f4..c91d07dd6a74 100644 --- a/icu4c/source/i18n/unicode/messageformat2_function_registry.h +++ b/icu4c/source/i18n/unicode/messageformat2_function_registry.h @@ -10,6 +10,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/messageformat2_data_model_names.h" #include "unicode/messageformat2_formattable.h" @@ -380,6 +382,8 @@ U_NAMESPACE_END #endif // U_HIDE_DEPRECATED_API +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/icu4c/source/test/intltest/itformat.cpp b/icu4c/source/test/intltest/itformat.cpp index c3c3a0dd0687..4f8fdc7a1a06 100644 --- a/icu4c/source/test/intltest/itformat.cpp +++ b/icu4c/source/test/intltest/itformat.cpp @@ -288,7 +288,9 @@ void IntlTestFormat::runIndexedTest( int32_t index, UBool exec, const char* &nam callTest(*test, par); } break; +#ifndef UCONFIG_NO_MF2 TESTCLASS(60,TestMessageFormat2); +#endif default: name = ""; break; //needed to end loop } if (exec) { diff --git a/icu4c/source/test/intltest/messageformat2test.cpp b/icu4c/source/test/intltest/messageformat2test.cpp index 72962c2fc202..e674c94857bc 100644 --- a/icu4c/source/test/intltest/messageformat2test.cpp +++ b/icu4c/source/test/intltest/messageformat2test.cpp @@ -4,6 +4,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/calendar.h" #include "messageformat2test.h" @@ -1067,5 +1069,7 @@ void TestMessageFormat2::testInvalidPatterns() { testInvalidPattern(++i, ".match {1} {{_}}", 12); } +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/test/intltest/messageformat2test.h b/icu4c/source/test/intltest/messageformat2test.h index 5fabdf1f95e4..661b0ba6dfe1 100644 --- a/icu4c/source/test/intltest/messageformat2test.h +++ b/icu4c/source/test/intltest/messageformat2test.h @@ -9,6 +9,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "messageformat2test_utils.h" #include "unicode/unistr.h" #include "unicode/messageformat2_formattable.h" @@ -197,6 +199,8 @@ class ResourceManager : public Formatter { } // namespace message2 U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif diff --git a/icu4c/source/test/intltest/messageformat2test_builtin.cpp b/icu4c/source/test/intltest/messageformat2test_builtin.cpp index 49fe74e0f04c..3a0a7ceefa66 100644 --- a/icu4c/source/test/intltest/messageformat2test_builtin.cpp +++ b/icu4c/source/test/intltest/messageformat2test_builtin.cpp @@ -4,6 +4,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/calendar.h" #include "messageformat2test.h" @@ -188,4 +190,6 @@ void TestMessageFormat2::testBuiltInFunctions() { testNumbers(errorCode); } +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/test/intltest/messageformat2test_custom.cpp b/icu4c/source/test/intltest/messageformat2test_custom.cpp index 4e6ef18195c0..2d7d89ee24c2 100644 --- a/icu4c/source/test/intltest/messageformat2test_custom.cpp +++ b/icu4c/source/test/intltest/messageformat2test_custom.cpp @@ -4,6 +4,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "plurrule_impl.h" #include "unicode/listformatter.h" @@ -725,4 +727,6 @@ void TestMessageFormat2::testMessageRefFormatter(IcuTestErrorCode& errorCode) { TestUtils::runTestCase(*this, test, errorCode); } +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/test/intltest/messageformat2test_features.cpp b/icu4c/source/test/intltest/messageformat2test_features.cpp index 6310b4ff84e6..f4c2ffdb82b7 100644 --- a/icu4c/source/test/intltest/messageformat2test_features.cpp +++ b/icu4c/source/test/intltest/messageformat2test_features.cpp @@ -4,6 +4,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/gregocal.h" #include "messageformat2test.h" @@ -471,4 +473,6 @@ void TestMessageFormat2::featureTests() { TestCase::~TestCase() {} TestCase::Builder::~Builder() {} +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/test/intltest/messageformat2test_fromjson.cpp b/icu4c/source/test/intltest/messageformat2test_fromjson.cpp index 0598c1f13470..b7389d033683 100644 --- a/icu4c/source/test/intltest/messageformat2test_fromjson.cpp +++ b/icu4c/source/test/intltest/messageformat2test_fromjson.cpp @@ -4,6 +4,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "messageformat2test.h" using namespace icu::message2; @@ -1257,4 +1259,7 @@ See https://github.com/unicode-org/message-format-wg/issues/726 // TODO: tests for other function options? } + +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/test/intltest/messageformat2test_icu.cpp b/icu4c/source/test/intltest/messageformat2test_icu.cpp index 7ea368e215c5..d1dfa389ca8c 100644 --- a/icu4c/source/test/intltest/messageformat2test_icu.cpp +++ b/icu4c/source/test/intltest/messageformat2test_icu.cpp @@ -4,6 +4,8 @@ #if !UCONFIG_NO_FORMATTING +#if !UCONFIG_NO_MF2 + #include "unicode/gregocal.h" #include "unicode/msgfmt.h" #include "messageformat2test.h" @@ -152,4 +154,6 @@ void TestMessageFormat2::messageFormat1Tests() { testMf1Behavior(testBuilder, errorCode); } +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/test/intltest/messageformat2test_utils.h b/icu4c/source/test/intltest/messageformat2test_utils.h index a8e2abd20627..a26a07625707 100644 --- a/icu4c/source/test/intltest/messageformat2test_utils.h +++ b/icu4c/source/test/intltest/messageformat2test_utils.h @@ -4,6 +4,10 @@ #ifndef _TESTMESSAGEFORMAT2_UTILS #define _TESTMESSAGEFORMAT2_UTILS +#if !UCONFIG_NO_FORMATTING + +#if !UCONFIG_NO_MF2 + #include "unicode/locid.h" #include "unicode/messageformat2_formattable.h" #include "unicode/messageformat2.h" @@ -11,8 +15,6 @@ #include "messageformat2_macros.h" #include "messageformat2_serializer.h" -#if !UCONFIG_NO_FORMATTING - U_NAMESPACE_BEGIN namespace message2 { class TestCase : public UMemory { @@ -307,6 +309,8 @@ class TestUtils { } // namespace message2 U_NAMESPACE_END +#endif /* #if !UCONFIG_NO_MF2 */ + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif