⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243311 in webkit


Ignore:
Timestamp:
Mar 21, 2019, 12:09:10 PM (7 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] Fix JSC build with newer ICU
https://bugs.webkit.org/show_bug.cgi?id=196098

Reviewed by Keith Miller.

IntlDateTimeFormat and IntlNumberFormat have switch statement over ICU's enums. However it lacks "default" clause so that
the compile error occurs when a new enum value is added in ICU side. We should have "default" clause which just fallbacks
"unknown"_s case. The behavior is not changed since we already have return "unknown"_s; statement anyway after the
switch statement. This patch just suppresses a compile error.

  • runtime/IntlDateTimeFormat.cpp:

(JSC::IntlDateTimeFormat::partTypeString):

  • runtime/IntlNumberFormat.cpp:

(JSC::IntlNumberFormat::partTypeString):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r243299 r243311  
     12019-03-21  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Fix JSC build with newer ICU
     4        https://bugs.webkit.org/show_bug.cgi?id=196098
     5
     6        Reviewed by Keith Miller.
     7
     8        IntlDateTimeFormat and IntlNumberFormat have switch statement over ICU's enums. However it lacks "default" clause so that
     9        the compile error occurs when a new enum value is added in ICU side. We should have "default" clause which just fallbacks
     10        "unknown"_s case. The behavior is not changed since we already have `return "unknown"_s;` statement anyway after the
     11        switch statement. This patch just suppresses a compile error.
     12
     13        * runtime/IntlDateTimeFormat.cpp:
     14        (JSC::IntlDateTimeFormat::partTypeString):
     15        * runtime/IntlNumberFormat.cpp:
     16        (JSC::IntlNumberFormat::partTypeString):
     17
    1182019-03-21  Tadeu Zagallo  <tzagallo@apple.com>
    219
  • trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp

    r240557 r243311  
    978978    case UDAT_FIELD_COUNT:
    979979#endif
     980    // Any newer additions to the UDateFormatField enum should just be considered an "unknown" part.
     981    default:
    980982        return "unknown"_s;
    981983    }
    982     // Any newer additions to the UDateFormatField enum should just be considered an "unknown" part.
    983984    return "unknown"_s;
    984985}
  • trunk/Source/JavaScriptCore/runtime/IntlNumberFormat.cpp

    r240992 r243311  
    477477    case UNUM_FIELD_COUNT:
    478478#endif
     479    // Any newer additions to the UNumberFormatFields enum should just be considered an "unknown" part.
     480    default:
    479481        return "unknown"_s;
    480482    }
    481     // Any newer additions to the UNumberFormatFields enum should just be considered an "unknown" part.
    482483    return "unknown"_s;
    483484}
Note: See TracChangeset for help on using the changeset viewer.