Commit graph

2127 commits

Author SHA1 Message Date
Peter Edberg
89fe16ef3b ICU-22142 Deprecate ICU4C createMetricTon/getMetricTon, ICU4J METRIC_TON
Some checks are pending
GHA ICU Merge CI / icu4j-dateformatperf (en_US, "HH:mm" "13:13" 2, TestICUParse) (push) Blocked by required conditions
GHA ICU Merge CI / icu4j-dateformatperf (en_US, "dddd MMM yyyy" "15 Jan 2007" 1, TestICUConstruction) (push) Blocked by required conditions
GHA ICU Merge CI / icu4j-dateformatperf (en_US, "dddd MMM yyyy" "15 Jan 2007" 1, TestICUFormat) (push) Blocked by required conditions
GHA ICU Merge CI / icu4j-dateformatperf (en_US, "dddd MMM yyyy" "15 Jan 2007" 1, TestICUParse) (push) Blocked by required conditions
GHA ICU Merge CI / icu4j-dateformatperf (sw_KE, "dddd MMM yyyy" "15 Jan 2007" 1, TestICUConstruction) (push) Blocked by required conditions
GHA ICU Merge CI / icu4j-dateformatperf (sw_KE, "dddd MMM yyyy" "15 Jan 2007" 1, TestICUFormat) (push) Blocked by required conditions
GHA ICU Merge CI / icu4j-dateformatperf (sw_KE, "dddd MMM yyyy" "15 Jan 2007" 1, TestICUParse) (push) Blocked by required conditions
GHA ICU Merge CI / icu4c-windows-msvc-postmerge (x64, Debug, x64) (push) Waiting to run
GHA ICU Merge CI / icu4c-windows-msvc-postmerge (x64, Release, x64) (push) Waiting to run
GHA ICU Merge CI / icu4c-windows-msvc-postmerge (x86, Debug, Win32) (push) Waiting to run
GHA ICU Merge CI / icu4c-windows-msvc-postmerge (x86, Release, Win32) (push) Waiting to run
GHA ICU Merge CI / icu4c-windows-cygwin-gcc (push) Waiting to run
GHA CI Valgrind / clang-valgrind-intltest (icuserv) (push) Waiting to run
GHA CI Valgrind / clang-valgrind-intltest (idna) (push) Waiting to run
GHA CI Valgrind / clang-valgrind-test (push) Waiting to run
GHA CI Valgrind / clang-valgrind-intltest (bidi) (push) Waiting to run
GHA CI Valgrind / clang-valgrind-intltest (collator) (push) Waiting to run
GHA CI Valgrind / clang-valgrind-intltest (convert) (push) Waiting to run
GHA CI Valgrind / clang-valgrind-intltest (csdet) (push) Waiting to run
GHA CI Valgrind / clang-valgrind-intltest (format) (push) Waiting to run
GHA CI Valgrind / clang-valgrind-intltest (normalize) (push) Waiting to run
GHA CI Valgrind / clang-valgrind-intltest (rbbi) (push) Waiting to run
GHA CI Valgrind / clang-valgrind-intltest (rbnf) (push) Waiting to run
GHA CI Valgrind / clang-valgrind-intltest (rbnfp) (push) Waiting to run
GHA CI Valgrind / clang-valgrind-intltest (rbnfrt) (push) Waiting to run
GHA CI Valgrind / clang-valgrind-intltest (regex) (push) Waiting to run
GHA CI Valgrind / clang-valgrind-intltest (spoof) (push) Waiting to run
GHA CI Valgrind / clang-valgrind-intltest (translit) (push) Waiting to run
GHA CI Valgrind / clang-valgrind-intltest (utility) (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
2025-04-05 10:04:01 -07:00
Tim Chevalier
d0e30acc68 ICU-23059 ICU4C MF2: Spec test updates
Some checks failed
GHA CI Valgrind / clang-valgrind-intltest (spoof) (push) Has been cancelled
GHA CI Valgrind / clang-valgrind-intltest (translit) (push) Has been cancelled
GHA ICU4C / uconfig-header-tests (-DUCONFIG_NO_IDNA=1) (push) Has been cancelled
GHA ICU4C / uconfig-header-tests (-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_REG… (push) Has been cancelled
GHA ICU4C / uconfig-header-tests (-DUCONFIG_NO_LEGACY_CONVERSION=1) (push) Has been cancelled
GHA ICU4C / icu4c-without-collation-rule-strings (push) Has been cancelled
GHA ICU4C / icu4c-icuexportdata (push) Has been cancelled
GHA CI Valgrind / clang-valgrind-intltest (rbbi) (push) Has been cancelled
GHA CI Valgrind / clang-valgrind-test (push) Has been cancelled
GHA CI Valgrind / clang-valgrind-intltest (bidi) (push) Has been cancelled
GHA CI Valgrind / clang-valgrind-intltest (collator) (push) Has been cancelled
GHA CI Valgrind / clang-valgrind-intltest (convert) (push) Has been cancelled
GHA CI Valgrind / clang-valgrind-intltest (csdet) (push) Has been cancelled
GHA CI Valgrind / clang-valgrind-intltest (format) (push) Has been cancelled
GHA CI Valgrind / clang-valgrind-intltest (rbnfrt) (push) Has been cancelled
GHA CI Valgrind / clang-valgrind-intltest (regex) (push) Has been cancelled
GHA ICU4C / uconfig-header-tests (-DUCONFIG_NO_MF2=1) (push) Has been cancelled
GHA ICU4C / uconfig-header-tests (-DUCONFIG_NO_NORMALIZATION=1) (push) Has been cancelled
GHA ICU4C / uconfig-header-tests (-DUCONFIG_NO_REGULAR_EXPRESSIONS=1) (push) Has been cancelled
GHA ICU4C / uconfig-header-tests (-DUCONFIG_NO_SERVICE=1) (push) Has been cancelled
GHA ICU4C / uconfig-header-tests (-DUCONFIG_NO_TRANSLITERATION=1) (push) Has been cancelled
GHA ICU4C / unicode-update-tools (push) Has been cancelled
GHA ICU4C / icu4c-test-samples (push) Has been cancelled
GHA ICU4C / icu4c-uconfig-no-conversion (push) Has been cancelled
GHA CI Valgrind / clang-valgrind-intltest (icuserv) (push) Has been cancelled
GHA CI Valgrind / clang-valgrind-intltest (idna) (push) Has been cancelled
GHA CI Valgrind / clang-valgrind-intltest (normalize) (push) Has been cancelled
GHA CI Valgrind / clang-valgrind-intltest (rbnf) (push) Has been cancelled
GHA CI Valgrind / clang-valgrind-intltest (rbnfp) (push) Has been cancelled
GHA CI Valgrind / clang-valgrind-intltest (utility) (push) Has been cancelled
Update spec tests to current version from message-format-wg

  - Update parser for changed name-start grammar rule
  - Validate number literals in :number implementation (since parser no longer does this)
  - Disallow `:number`/`:integer` select option set from variable

    See https://github.com/unicode-org/message-format-wg/pull/1016

    As part of this, un-skip tests where the `bad-option` error is
    expected, and implement validating digit size options
    (pending PR https://github.com/unicode-org/icu/pull/2973 is intended
    to do this more fully)
2025-03-27 15:20:49 -07:00
Tim Chevalier
c5b7dce96b ICU-23073 Use string_view constants for option names and formatter names 2025-03-13 10:21:46 -07:00
Tim Chevalier
0748442ed6 ICU-23059 ICU4C MF2: Update spec tests
This updates the MF2 spec tests to 943479b602 with the following exceptions:

- functions/currency.json and functions/math.json are omitted because these are not yet implemented

- bidi.json will be handled in a future PR

- u-options.json will be handled in a future PR

Changes include:
* `:integer` now returns a value encapsulating the rounded numeric value of the argument, rather than
  the value itself.
* Fallbacks are handled according to the current spec.
* Fallback values are not passed into functions.
* Characters inside literal fallbacks are properly escaped.
* The test runner skips null values properly.
* The test runner handles boolean `expErrors` in defaultTestProperties.
* `:string` normalizes its input and normalizeNFC() has been refactored so it can be called there.
2025-02-25 12:24:07 -08:00
Frank Tang
59af52bb6f ICU-23043 Propogate error in Calendar. 2025-02-11 15:14:27 -08:00
Mihai Nita
339ebb368f ICU-22781 Data generated with the concentr/perbillion on, code update
Following the steps in docs/processes/release/tasks/updating-measure-unit.md
2025-02-10 10:46:19 -08:00
Tim Chevalier
7b8110f003 ICU-22907 MF2: Finish updating spec tests and implement required test functions
Implement :test:format, :test:select, and :test:function, which are
required by the new `pattern-selection.json` tests.

Change the internal value representation in the formatter in order to
support some of the test cases (binding the results of selectors to a
variable).
2025-02-08 21:42:03 -06:00
Fredrik Roubert
ee8806e87c ICU-22954 Make UCollator predicates usable without U_SHOW_CPLUSPLUS_API.
Until now, the implementation of the UCollator predicates has been using
UnicodeString and StringPiece as convenient wrappers for converting from
standard C++ data types to ICU4C data types.

But as that doesn't work when the client uses ICU4C built without
U_SHOW_CPLUSPLUS_API this is now changed to instead perform these
conversions directly.

(It's a bit more code, but does just the same thing in the end.)
2025-02-07 20:14:20 +01:00
Younies Mahmoud
362a4aa94b ICU-23032 Update MeasureUnit documentation for forIdentifier method
See #3360
2025-02-06 16:37:58 +01:00
Rich Gillam
f9ee689d7a ICU-22922 Promoted all @draft ICU 75 APIs to @stable ICU 75. 2025-02-05 13:02:56 -08:00
Arthur O'Dwyer
fb64693c28 ICU-22920 Avoid "return by const value" antipattern
Returning a const-qualified prvalue doesn't do anything useful, but it does
turn an assignment such as `v = rb.getLocale();` from a move-assignment
into a copy-assignment (because it's forbidden to move-from a const value,
even if it's a const prvalue). Each affected site was diagnosed mechanically
by my fork of Clang. E.g.:

    warning: 'const' type qualifier on return type is a bad idea [-Wqual-class-return-type]
      391 | const Locale ResourceBundle::getLocale(ULocDataLocaleType type, UErrorCode &status) const
          | ^~~~~
2025-01-30 10:58:25 -08:00
Younies Mahmoud
ba4d4d3ac2 ICU-22781 Adding support for constant denominators (C++)
See #3337
2025-01-24 02:06:43 +01:00
George Rhoten
2d6a4185c3 ICU-22979 Support inverse rule for [] span in RBNF 2025-01-15 08:56:08 -08:00
Frank Tang
9eafd8ca3e ICU-22991 Reduce Calendar object size
See #3327
2025-01-08 12:26:35 -08:00
Frank Tang
6091406a3a ICU-22991 Reduce fStamp to 8 bits
See #3323
2025-01-06 18:38:17 -08:00
Frank Yung-Fong Tang
4c3622f218 ICU-23000 Replace CharString for LocaleBased
See #3321
2025-01-06 14:09:30 -08:00
Frank Tang
841e88bc8c ICU-22991 Remove unused private fIsSet
This field is removed in Java 24 years ago. Save 24 bytes per Calendar
object.
2024-12-23 14:58:56 -08:00
Frank Tang
ff31805f56 ICU-22991 Change fIsTimeSet fAreFieldsSet fAreAllFieldsSet fAreFieldsVirtuallySet fIsSet fStamp to private
https://docs.google.com/document/d/1RqP3s7Y1YLahqopNcuadl3DT-DMIZ7ASXZbSy7M2mFE/edit?tab=t.0#heading=h.lok0fhe381qa
2024-12-23 12:51:13 -08:00
Markus Scherer
c0a3fe15d4 ICU-22954 Partially revert PR #3295 U_ICU_NAMESPACE_OR_INTERNAL, header-only localpointer
This partially reverts commit 3527b3d320.

Making LocalPointer header-only, with a different namespace when compiling internally,
turned out to be problematic.
2024-12-23 11:17:14 -08:00
Markus Scherer
38b6d7fe5a ICU-22954 Revert PR #3295 make all LocalXyzPointer header-only
This reverts commit 5bdb4c44af.

Making LocalPointer header-only, with a different namespace when compiling internally,
turned out to be problematic.
2024-12-23 11:17:14 -08:00
Frank Tang
7546622f87 ICU-22991 Remove unnecessary computeGregorianAndDOWFields private
Move the DOW calculation into computeWeekFields
2024-12-20 16:33:53 -08:00
Markus Scherer
70409090de ICU-22954 make all LocalXyzPointer header-only 2024-12-19 17:40:33 -08:00
Markus Scherer
8655718531 ICU-22954 U_ICU_NAMESPACE_OR_INTERNAL, header-only localpointer
header-only parts of char16ptr.h
2024-12-19 17:40:33 -08:00
Tim Chevalier
62b95bb5f9 ICU-22908 MF2: Update spec tests and update implementation for recent spec changes
Updating the spec tests requires two implementation changes:
* Match on variables rather than expressions --
  see https://github.com/unicode-org/message-format-wg/pull/877
* Require attribute values to be literals (if present) --
  see https://github.com/unicode-org/message-format-wg/pull/894

This updates the spec tests to commit 6c3704f41a9c24427126429fb43992b03609dfc8
in https://github.com/unicode-org/message-format-wg/ . Any changes
following that commit will be addressed in a future PR.
2024-12-09 09:38:28 -08:00
Tim Chevalier
0357501948 ICU-22942 MF2 ICU4C: NFC-normalize names and keys according to spec
Includes adding !UCONFIG_NO_NORMALIZATION guards to all MF2 files
2024-11-06 12:48:35 -08:00
DraganBesevic
de86b3269e ICU-22723 Integrate CLDR 46 release beta3, part 3, source files 2024-09-27 22:38:13 -07:00
Tim Chevalier
2f348f4c7a ICU-22902 Remove support for Unsupported, Private & Reserved constructs
Matching PR #883 in the message-format-wg repo.

Also move spec tests for unsupported statements and expressions into new files
to serve as syntax error tests.
2024-09-20 17:29:07 -07:00
Shane F. Carr
94057e9550 ICU-22900 Remove deprecated SimpleNumber truncateStart
See #3192
2024-09-20 12:10:41 -07:00
Tim Chevalier
23edf9cca6 ICU-22762 MF2: Add builder method to control error handling behavior
Add MessageFormatter::Builder::setErrorHandlingBehavior() method
and a new enum type MessageFormatter::UMFErrorHandlingBehavior
to denote strict or best-effort behavior.

The reason for adding a single method that takes an enum is to allow
for the possibility of more error handling modes in the future.

Co-authored-by: Markus Scherer <markus.icu@gmail.com>
2024-09-19 13:21:56 -07:00
Peter Edberg
ac737dabcf ICU-12865 Update API docs to reflect new features in ICU 54 and later :-) 2024-09-19 11:19:15 -07:00
Fredrik Roubert
0bf8a95309 ICU-22793 Remove superfluous return value typecasts to UBool. 2024-09-19 17:11:38 +02:00
Tim Chevalier
747d5eef3b ICU-22834 Update tests to reflect MF2 schema in conformance repo
This also updates the spec tests from the current version of the MFWG
repository and removes some duplicate tests.
Spec tests now reflect the message-format-wg repo as of
5612f3b050

It also updates both the ICU4C and ICU4J parsers to follow the
current test schema in the conformance repository.

This includes adding code to both parsers to allow `src` to be
either a single string or an array of strings (per
https://github.com/unicode-org/conformance/pull/255 ),
and eliminating `srcs` in tests.

It also includes other changes to make updated spec tests pass:

ICU4C: Allow trailing whitespace for complex messages, due to spec change
ICU4C: Parse number literals correctly in Number::format
ICU4J: Allow trailing whitespace after complex body, per spec change
ICU4C: Fix bug that was assuming an .input variable can't have a reserved annotation
ICU4C: Fix bug where unsupported '.i' was parsed as an '.input'
ICU4C/ICU4J: Handle markup with space after the initial left curly brace
ICU4C: Check for duplicate variant errors
ICU4C/ICU4J: Handle leading whitespace in complex messages
ICU4J: Treat whitespace after .input keyword as optional
ICU4J: Don't format unannotated number literals as numbers
2024-09-18 07:46:29 -07:00
Fredrik Roubert
b160feaac2 ICU-22879 Provide collator based predicates for use with STL algorithms. 2024-09-17 20:44:21 +02:00
Rich Gillam
d0fb2d54b3 ICU-22723 Promoted all @draft ICU 74 APIs to @stable ICU 74 2024-09-11 14:06:45 -07:00
Anton Voloshin
e4cba341b6 ICU-22850 ucol_openRules: fix ucol_open reference in the description
It should obviously be ucol_open here. This typo was introduced in the
0335b3b9c3
2024-08-19 13:03:21 -07:00
Fredrik Roubert
0178a07a26 ICU-22793 Clang-Tidy: google-readability-casting
https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/google/readability-casting.html
2024-07-04 22:32:12 +02:00
Frank Tang
0c02f8c007 ICU-22743 Change internal functions to propagate errors up. 2024-04-18 15:32:59 -07:00
Mihai Nita
aebd5ba54b ICU-22533 Change API version annotation from 75.0 to 75 2024-04-15 11:17:15 -07:00
Elango Cheran
a1bce0c096 ICU-22261 Refactor error handling for internal MF2 array-allocating functions 2024-04-12 09:22:15 -07:00
Fredrik Roubert
75eab42060 ICU-22261 Improved identification of the MSVC compiler and library.
It's not uncommon for code for Windows to use the _MSC_VER preprocessor
macro to identify that it's being compiled for Windows so it's also not
uncommon for compilers other than the real MSVC compiler to also set
this to be able to compile such code.

It's also not possible to use _MSC_VER to determine whether the C++
standard library implementation used is the Microsoft STL.

Clang will however refuse to instantiate a template with a forward
declared type, so the code that currently does this needs to be moved to
after the type has been properly defined, which in turn makes MSVC warn
that those templates aren't instantiated, so those warnings need to be
disabled, but then the disabling of warning C4661 doesn't work any
longer (for some unknown reason) but this can be resolved by properly
deleting the non-existent operators instead of disabling the warning.
2024-04-11 15:35:23 -07:00
Tim Chevalier
9e1c66daf7 ICU-22261 Refactor MF2 attributes and options parsing code
Previously, there were separate overrides for the options and
attributes parsing methods in the parser that were used in different
context. (Options can appear in Operator and Markup, while attributes
can appear in Expression and Markup.)

This is a refactoring that eliminates this duplicated code.
To enable it, a builder is added for the internal OptionMap type.

Separately, this patch also explicitly deletes copy constructors
and copy assignment operators for all Builder classes; a bug in an
earlier version of this patch caused me to notice this hadn't been
done. Also explicitly deletes move constructors/assignment operators
with the exception of OptionMap::Builder (OptionMap is non-public,
so that shouldn't cause confusion).
2024-04-09 08:15:54 -07:00
Tim Chevalier
4f0c2ca71c ICU-22261 Remove MF2 formatter caching optimization
The implementation was keeping a cache of FormatterFactory
    objects so that subsequent calls to the same formatter re-use the
    same object.
    The problem is that this is unsafe, because
    `MFFunctionRegistry::getFormatter()` returns a non-const `FormatterFactory*`;
    so if the caller deleted the resulting pointer, the formatter cache
    would contain a dangling pointer.
    
    This optimization was added because of an ICU4J test that checked for
    the presence of the optimization. However, for separate reasons
    (making `adoptFormatter()` actually adopt its argument), this test
    was already removed.
    
    The caching could be re-added later if that optimization is needed,
    but for now, remove it (also, no tests were checking for its presence).
2024-04-05 13:14:34 -07:00
Tim Chevalier
070a1f420b ICU-22261 Add missing API tags for MessageFormat 2 methods/constants 2024-03-28 15:46:32 -07:00
Tim Chevalier
aff1bbaa14 ICU-22261 Add UCONFIG_NO_MF2 flag that can be used to disable MessageFormat 2 functionality 2024-03-28 08:48:35 -07:00
Tim Chevalier
f7d641d5ad ICU-22261 Add tech preview implementation for MessageFormat 2.0 to icu4c 2024-03-27 17:04:07 -04:00
Shane F. Carr
8a1df5a7f4 ICU-22692 Change SimpleNumber truncateAt to setMaximumIntegerDigits
Also promotes the remaining draft SimpleNumber functions to stable.

See #2892
2024-03-26 16:13:46 -07:00
Rich Gillam
13bf3c8313 ICU-22611 Fixed the RBNF MultiplierSubstitution to only perform floor() on the value being formatted when the
substitution is using a DecimalFormat and its owning rule also has a modulus substitution.  Took out a redundant
call to floor().  Added a hack to allow the caller to change the rounding behavior with setRoundingMode().
Added appropriate unit tests. Added additional documentation of the behavior to the API docs.
2024-03-22 11:18:27 -07:00
Fredrik Roubert
2a6bc212d4 ICU-22691 Delete abandoned sample code. 2024-03-21 23:19:54 +01:00
Frank Tang
37bdffb240 ICU-22679 Fix broken header test
See #2918
2024-03-21 15:12:10 -07:00
Frank Tang
fbc1f33e7e ICU-22679 Clean up Calendar code.
1. Remove redudant implementation of default system ceuntry by using
   macro
2. Fold long if / else block if one block return.
2024-03-21 09:50:10 -07:00