enum.patch 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. diff --git a/CMakeLists.txt b/CMakeLists.txt
  2. index dd198286..2be84c5f 100644
  3. --- a/CMakeLists.txt
  4. +++ b/CMakeLists.txt
  5. @@ -235,7 +235,7 @@ if(USING_GCC)
  6. endif()
  7. if(USING_CLANG)
  8. - jerry_add_compile_flags(-Wno-nested-anon-types -Wno-static-in-inline)
  9. + jerry_add_compile_flags(-Wno-nested-anon-types -Wno-static-in-inline -Wno-enum-enum-conversion)
  10. endif()
  11. if(USING_TI)
  12. diff --git a/jerry-core/api/jerryscript.c b/jerry-core/api/jerryscript.c
  13. index 60f8023f..59cbcb4c 100644
  14. --- a/jerry-core/api/jerryscript.c
  15. +++ b/jerry-core/api/jerryscript.c
  16. @@ -82,13 +82,13 @@ JERRY_STATIC_ASSERT ((int) ECMA_PROMISE_IS_PENDING == (int) JERRY_PROMISE_STATE_
  17. /**
  18. * Offset between internal and external arithmetic operator types
  19. */
  20. -#define ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET (JERRY_BIN_OP_SUB - NUMBER_ARITHMETIC_SUBTRACTION)
  21. +#define ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET ((int) JERRY_BIN_OP_SUB - (int) NUMBER_ARITHMETIC_SUBTRACTION)
  22. -JERRY_STATIC_ASSERT (((NUMBER_ARITHMETIC_SUBTRACTION + ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET) == JERRY_BIN_OP_SUB)
  23. - && ((NUMBER_ARITHMETIC_MULTIPLICATION + ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET)
  24. - == JERRY_BIN_OP_MUL)
  25. - && ((NUMBER_ARITHMETIC_DIVISION + ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET) == JERRY_BIN_OP_DIV)
  26. - && ((NUMBER_ARITHMETIC_REMAINDER + ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET) == JERRY_BIN_OP_REM),
  27. +JERRY_STATIC_ASSERT ((((int) NUMBER_ARITHMETIC_SUBTRACTION + (int) ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET) == (int) JERRY_BIN_OP_SUB)
  28. + && (((int) NUMBER_ARITHMETIC_MULTIPLICATION + (int) ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET)
  29. + == (int) JERRY_BIN_OP_MUL)
  30. + && (((int) NUMBER_ARITHMETIC_DIVISION + (int) ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET) == (int) JERRY_BIN_OP_DIV)
  31. + && (((int) NUMBER_ARITHMETIC_REMAINDER + (int) ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET) == (int) JERRY_BIN_OP_REM),
  32. number_arithmetics_operation_type_matches_external);
  33. #if !JERRY_PARSER && !JERRY_SNAPSHOT_EXEC
  34. @@ -1841,7 +1841,7 @@ jerry_binary_op (jerry_binary_op_t operation, /**< operation */
  35. case JERRY_BIN_OP_DIV:
  36. case JERRY_BIN_OP_REM:
  37. {
  38. - return jerry_return (do_number_arithmetic (operation - ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET, lhs, rhs));
  39. + return jerry_return (do_number_arithmetic (operation - (int) ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET, lhs, rhs));
  40. }
  41. default:
  42. {
  43. @@ -4854,7 +4854,7 @@ jerry_symbol (jerry_well_known_symbol_t symbol) /**< jerry_well_known_symbol_t e
  44. {
  45. jerry_assert_api_enabled ();
  46. - lit_magic_string_id_t id = (lit_magic_string_id_t) (LIT_GLOBAL_SYMBOL__FIRST + symbol);
  47. + lit_magic_string_id_t id = (lit_magic_string_id_t) ((int) LIT_GLOBAL_SYMBOL__FIRST + (int) symbol);
  48. if (!LIT_IS_GLOBAL_SYMBOL (id))
  49. {
  50. diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c
  51. index 94c0384d..98c25eae 100644
  52. --- a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c
  53. +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c
  54. @@ -251,7 +251,7 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this */
  55. ecma_value_t status = ecma_builtin_helper_def_prop (this_obj_p,
  56. ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),
  57. ecma_make_uint32_value (0),
  58. - ECMA_PROPERTY_FLAG_WRITABLE | JERRY_PROP_SHOULD_THROW);
  59. + (int) ECMA_PROPERTY_FLAG_WRITABLE | (int) JERRY_PROP_SHOULD_THROW);
  60. ecma_bytecode_deref ((ecma_compiled_code_t *) old_bc_p);
  61. diff --git a/jerry-core/ecma/operations/ecma-bigint.c b/jerry-core/ecma/operations/ecma-bigint.c
  62. index 7a4464e0..5f291a57 100644
  63. --- a/jerry-core/ecma/operations/ecma-bigint.c
  64. +++ b/jerry-core/ecma/operations/ecma-bigint.c
  65. @@ -1584,14 +1584,14 @@ ecma_bigint_and (ecma_value_t left_value, /**< left BigInt value */
  66. }
  67. /* x & (-y) == x & ~(y-1) == x &~ (y-1) */
  68. - uint32_t operation_and_options = ECMA_BIG_UINT_BITWISE_AND_NOT | ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT;
  69. + uint32_t operation_and_options = (uint32_t) ECMA_BIG_UINT_BITWISE_AND_NOT | (uint32_t) ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT;
  70. return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);
  71. }
  72. if (!(right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN))
  73. {
  74. /* (-x) & y == ~(x-1) & y == y &~ (x-1) */
  75. - uint32_t operation_and_options = ECMA_BIG_UINT_BITWISE_AND_NOT | ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT;
  76. + uint32_t operation_and_options = (uint32_t) ECMA_BIG_UINT_BITWISE_AND_NOT | (uint32_t) ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT;
  77. return ecma_bigint_bitwise_op (operation_and_options, right_p, left_p);
  78. }
  79. @@ -1633,7 +1633,7 @@ ecma_bigint_or (ecma_value_t left_value, /**< left BigInt value */
  80. /* x | (-y) == x | ~(y-1) == ~((y-1) &~ x) == -(((y-1) &~ x) + 1) */
  81. uint32_t operation_and_options =
  82. - (ECMA_BIG_UINT_BITWISE_AND_NOT | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
  83. + ((uint32_t) ECMA_BIG_UINT_BITWISE_AND_NOT | (uint32_t) ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | (uint32_t) ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
  84. return ecma_bigint_bitwise_op (operation_and_options, right_p, left_p);
  85. }
  86. @@ -1641,13 +1641,13 @@ ecma_bigint_or (ecma_value_t left_value, /**< left BigInt value */
  87. {
  88. /* (-x) | y == ~(x-1) | y == ~((x-1) &~ y) == -(((x-1) &~ y) + 1) */
  89. uint32_t operation_and_options =
  90. - (ECMA_BIG_UINT_BITWISE_AND_NOT | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
  91. + ((uint32_t) ECMA_BIG_UINT_BITWISE_AND_NOT | (uint32_t) ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | (uint32_t) ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
  92. return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);
  93. }
  94. /* (-x) | (-y) == ~(x-1) | ~(y-1) == ~((x-1) & (y-1)) = -(((x-1) & (y-1)) + 1) */
  95. uint32_t operation_and_options =
  96. - (ECMA_BIG_UINT_BITWISE_AND | ECMA_BIG_UINT_BITWISE_DECREASE_BOTH | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
  97. + ((uint32_t) ECMA_BIG_UINT_BITWISE_AND | (uint32_t) ECMA_BIG_UINT_BITWISE_DECREASE_BOTH | (uint32_t) ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
  98. return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);
  99. } /* ecma_bigint_or */
  100. @@ -1683,7 +1683,7 @@ ecma_bigint_xor (ecma_value_t left_value, /**< left BigInt value */
  101. /* x ^ (-y) == x ^ ~(y-1) == ~(x ^ (y-1)) == -((x ^ (y-1)) + 1) */
  102. uint32_t operation_and_options =
  103. - (ECMA_BIG_UINT_BITWISE_XOR | ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
  104. + ((int) ECMA_BIG_UINT_BITWISE_XOR | (int) ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT | (int) ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
  105. return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);
  106. }
  107. @@ -1691,7 +1691,7 @@ ecma_bigint_xor (ecma_value_t left_value, /**< left BigInt value */
  108. {
  109. /* (-x) | y == ~(x-1) ^ y == ~((x-1) ^ y) == -(((x-1) ^ y) + 1) */
  110. uint32_t operation_and_options =
  111. - (ECMA_BIG_UINT_BITWISE_XOR | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
  112. + ((int) ECMA_BIG_UINT_BITWISE_XOR | (int) ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | (int) ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
  113. return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);
  114. }
  115. diff --git a/jerry-core/ecma/operations/ecma-regexp-object.c b/jerry-core/ecma/operations/ecma-regexp-object.c
  116. index e5b276ae..5e8f2251 100644
  117. --- a/jerry-core/ecma/operations/ecma-regexp-object.c
  118. +++ b/jerry-core/ecma/operations/ecma-regexp-object.c
  119. @@ -164,7 +164,7 @@ ecma_op_regexp_alloc (ecma_object_t *ctr_obj_p) /**< constructor object pointer
  120. ecma_value_t status = ecma_builtin_helper_def_prop (new_object_p,
  121. ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),
  122. ecma_make_uint32_value (0),
  123. - ECMA_PROPERTY_FLAG_WRITABLE | JERRY_PROP_SHOULD_THROW);
  124. + (uint32_t) ECMA_PROPERTY_FLAG_WRITABLE | (uint32_t) JERRY_PROP_SHOULD_THROW);
  125. JERRY_ASSERT (ecma_is_value_true (status));
  126. diff --git a/jerry-core/ecma/operations/ecma-typedarray-object.c b/jerry-core/ecma/operations/ecma-typedarray-object.c
  127. index 40b42bb6..c455dc92 100644
  128. --- a/jerry-core/ecma/operations/ecma-typedarray-object.c
  129. +++ b/jerry-core/ecma/operations/ecma-typedarray-object.c
  130. @@ -741,7 +741,7 @@ ecma_typedarray_helper_is_typedarray (ecma_builtin_id_t builtin_id) /**< the bui
  131. ecma_builtin_id_t
  132. ecma_typedarray_helper_get_prototype_id (ecma_typedarray_type_t typedarray_id) /**< the id of the typedarray **/
  133. {
  134. - return (ecma_builtin_id_t) (ECMA_FIRST_TYPEDARRAY_BUILTIN_PROTOTYPE_ID + typedarray_id);
  135. + return (ecma_builtin_id_t) ((uint32_t) ECMA_FIRST_TYPEDARRAY_BUILTIN_PROTOTYPE_ID + (uint32_t) typedarray_id);
  136. } /* ecma_typedarray_helper_get_prototype_id */
  137. /**
  138. @@ -752,7 +752,7 @@ ecma_typedarray_helper_get_prototype_id (ecma_typedarray_type_t typedarray_id) /
  139. ecma_builtin_id_t
  140. ecma_typedarray_helper_get_constructor_id (ecma_typedarray_type_t typedarray_id) /**< the id of the typedarray **/
  141. {
  142. - return (ecma_builtin_id_t) (ECMA_FIRST_TYPEDARRAY_BUILTIN_ROUTINE_ID + typedarray_id);
  143. + return (ecma_builtin_id_t) ((uint32_t) ECMA_FIRST_TYPEDARRAY_BUILTIN_ROUTINE_ID + (uint32_t) typedarray_id);
  144. } /* ecma_typedarray_helper_get_constructor_id */
  145. /**
  146. diff --git a/jerry-port/win/jerry-port-win-date.c b/jerry-port/win/jerry-port-win-date.c
  147. index 91aee326..35e55482 100644
  148. --- a/jerry-port/win/jerry-port-win-date.c
  149. +++ b/jerry-port/win/jerry-port-win-date.c
  150. @@ -46,7 +46,7 @@
  151. static void
  152. unix_time_to_filetime (double t, LPFILETIME ft_p)
  153. {
  154. - LONGLONG ll = (LONGLONG) t * TICKS_PER_MS + UNIX_EPOCH_IN_TICKS;
  155. + LONGLONG ll = (LONGLONG) t * (LONGLONG) TICKS_PER_MS + (LONGLONG) UNIX_EPOCH_IN_TICKS;
  156. /* FILETIME values before the epoch are invalid. */
  157. if (ll < 0)
  158. @@ -69,7 +69,7 @@ filetime_to_unix_time (LPFILETIME ft_p)
  159. ULARGE_INTEGER date;
  160. date.HighPart = ft_p->dwHighDateTime;
  161. date.LowPart = ft_p->dwLowDateTime;
  162. - return (double) (((LONGLONG) date.QuadPart - UNIX_EPOCH_IN_TICKS) / TICKS_PER_MS);
  163. + return (double) (((LONGLONG) date.QuadPart - (LONGLONG) UNIX_EPOCH_IN_TICKS) / (LONGLONG) TICKS_PER_MS);
  164. } /* filetime_to_unix_time */
  165. /**