Rework usages/naming of configuration macros [part 1] (#2793)
There are quite a few configuration macros in the project. As discussed in the #2520 issue there are a few awkward constructs. Main changes: * Renamed all CONFIG_DISABLE_<name>_BUILTIN macro to JERRY_BUILTIN_<name> format. * The special JERRY_BUILTINS macro specifies the basic config for all es5.1 builtins. * Renamed all CONFIG_DISABLE_ES2015_<name> to JERRY_ES2015_<name> format. * The special JERRY_ES2015 macro specifies the basic config for all es2015 builtins. * Renamed UNICODE_CASE_CONVERSION to JERRY_UNICODE_CASE_CONVERSION. * Renamed ENABLE_REGEXP_STRICT_MODE to JERRY_REGEXP_STRICT_MODE. * All options (in this change) can have a value of 0 or 1. * Renamed ENABLE_REGEXP_STRICT_MODE to JERRY_REGEXP_STRICT_MODE. JERRY_REGEXP_STRICT_MODE is set to 0 by default. * Reworked CONFIG_ECMA_NUMBER_TYPE macro to JERRY_NUMBER_TYPE_FLOAT64 name and now it uses the value 1 for 64 bit floating point numbers and 0 for 32 bit floating point number. By default the 64-bit floating point number mode is enabled. * All new JERRY_ defines can be used wit the `#if ENABLED (JERRY_...)` construct to test if the feature is enabled or not. * Added/replaced a few config.h includes to correctly propagate the macro values. * Added sanity checks for each macro to avoid incorrectly set values. * Updated profile documentation. * The CMake feature names are not updated at this point. JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
committed by
Robert Fancsik
parent
722d092528
commit
40f7b1c27f
@@ -30,7 +30,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_OBJECT,
|
||||
true,
|
||||
object)
|
||||
|
||||
#ifndef CONFIG_DISABLE_ARRAY_BUILTIN
|
||||
#if ENABLED (JERRY_BUILTIN_ARRAY)
|
||||
/* The Array.prototype object (15.4.4) */
|
||||
BUILTIN (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE,
|
||||
ECMA_OBJECT_TYPE_ARRAY,
|
||||
@@ -44,9 +44,9 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ARRAY,
|
||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||
true,
|
||||
array)
|
||||
#endif /* !CONFIG_DISABLE_ARRAY_BUILTIN*/
|
||||
#endif /* ENABLED (JERRY_BUILTIN_ARRAY) */
|
||||
|
||||
#ifndef CONFIG_DISABLE_STRING_BUILTIN
|
||||
#if ENABLED (JERRY_BUILTIN_STRING)
|
||||
/* The String.prototype object (15.5.4) */
|
||||
BUILTIN (ECMA_BUILTIN_ID_STRING_PROTOTYPE,
|
||||
ECMA_OBJECT_TYPE_CLASS,
|
||||
@@ -60,9 +60,9 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_STRING,
|
||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||
true,
|
||||
string)
|
||||
#endif /* !CONFIG_DISABLE_STRING_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_BUILTIN_STRING) */
|
||||
|
||||
#ifndef CONFIG_DISABLE_BOOLEAN_BUILTIN
|
||||
#if ENABLED (JERRY_BUILTIN_BOOLEAN)
|
||||
/* The Boolean.prototype object (15.6.4) */
|
||||
BUILTIN (ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE,
|
||||
ECMA_OBJECT_TYPE_CLASS,
|
||||
@@ -76,9 +76,9 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_BOOLEAN,
|
||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||
true,
|
||||
boolean)
|
||||
#endif /* !CONFIG_DISABLE_BOOLEAN_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_BUILTIN_BOOLEAN) */
|
||||
|
||||
#ifndef CONFIG_DISABLE_NUMBER_BUILTIN
|
||||
#if ENABLED (JERRY_BUILTIN_NUMBER)
|
||||
/* The Number.prototype object (15.7.4) */
|
||||
BUILTIN (ECMA_BUILTIN_ID_NUMBER_PROTOTYPE,
|
||||
ECMA_OBJECT_TYPE_CLASS,
|
||||
@@ -92,7 +92,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_NUMBER,
|
||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||
true,
|
||||
number)
|
||||
#endif /* !CONFIG_DISABLE_NUMBER_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_BUILTIN_NUMBER) */
|
||||
|
||||
/* The Function.prototype object (15.3.4) */
|
||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||
@@ -108,25 +108,25 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FUNCTION,
|
||||
true,
|
||||
function)
|
||||
|
||||
#ifndef CONFIG_DISABLE_MATH_BUILTIN
|
||||
#if ENABLED (JERRY_BUILTIN_MATH)
|
||||
/* The Math object (15.8) */
|
||||
BUILTIN (ECMA_BUILTIN_ID_MATH,
|
||||
ECMA_OBJECT_TYPE_GENERAL,
|
||||
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
|
||||
true,
|
||||
math)
|
||||
#endif /* !CONFIG_DISABLE_MATH_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_BUILTIN_MATH) */
|
||||
|
||||
#ifndef CONFIG_DISABLE_JSON_BUILTIN
|
||||
#if ENABLED (JERRY_BUILTIN_JSON)
|
||||
/* The JSON object (15.12) */
|
||||
BUILTIN (ECMA_BUILTIN_ID_JSON,
|
||||
ECMA_OBJECT_TYPE_GENERAL,
|
||||
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
|
||||
true,
|
||||
json)
|
||||
#endif /* !CONFIG_DISABLE_JSON_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_BUILTIN_JSON) */
|
||||
|
||||
#ifndef CONFIG_DISABLE_DATE_BUILTIN
|
||||
#if ENABLED (JERRY_BUILTIN_DATE)
|
||||
/* The Date.prototype object (15.9.4) */
|
||||
BUILTIN (ECMA_BUILTIN_ID_DATE_PROTOTYPE,
|
||||
ECMA_OBJECT_TYPE_CLASS,
|
||||
@@ -140,9 +140,9 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_DATE,
|
||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||
true,
|
||||
date)
|
||||
#endif /* !CONFIG_DISABLE_DATE_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_BUILTIN_DATE) */
|
||||
|
||||
#ifndef CONFIG_DISABLE_REGEXP_BUILTIN
|
||||
#if ENABLED (JERRY_BUILTIN_REGEXP)
|
||||
/* The RegExp.prototype object (15.10.6) */
|
||||
BUILTIN (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE,
|
||||
ECMA_OBJECT_TYPE_CLASS,
|
||||
@@ -156,7 +156,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_REGEXP,
|
||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||
true,
|
||||
regexp)
|
||||
#endif /* !CONFIG_DISABLE_REGEXP_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
|
||||
|
||||
/* The Error object (15.11.1) */
|
||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ERROR,
|
||||
@@ -172,7 +172,7 @@ BUILTIN (ECMA_BUILTIN_ID_ERROR_PROTOTYPE,
|
||||
true,
|
||||
error_prototype)
|
||||
|
||||
#ifndef CONFIG_DISABLE_ERROR_BUILTINS
|
||||
#if ENABLED (JERRY_BUILTIN_ERRORS)
|
||||
/* The EvalError.prototype object (15.11.6.1) */
|
||||
BUILTIN (ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE,
|
||||
ECMA_OBJECT_TYPE_GENERAL,
|
||||
@@ -256,7 +256,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_URI_ERROR,
|
||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||
true,
|
||||
uri_error)
|
||||
#endif /* !CONFIG_DISABLE_ERROR_BUILTINS */
|
||||
#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */
|
||||
|
||||
/**< The [[ThrowTypeError]] object (13.2.3) */
|
||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER,
|
||||
@@ -265,7 +265,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER,
|
||||
false,
|
||||
type_error_thrower)
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY)
|
||||
|
||||
/* The ArrayBuffer.prototype object (ES2015 24.1.4) */
|
||||
BUILTIN (ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE,
|
||||
@@ -379,7 +379,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FLOAT32ARRAY,
|
||||
true,
|
||||
float32array)
|
||||
|
||||
#if CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT64
|
||||
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
|
||||
BUILTIN (ECMA_BUILTIN_ID_FLOAT64ARRAY_PROTOTYPE,
|
||||
ECMA_OBJECT_TYPE_GENERAL,
|
||||
ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,
|
||||
@@ -391,7 +391,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FLOAT64ARRAY,
|
||||
ECMA_BUILTIN_ID_TYPEDARRAY,
|
||||
true,
|
||||
float64array)
|
||||
#endif /* CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT64 */
|
||||
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
|
||||
|
||||
BUILTIN (ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY_PROTOTYPE,
|
||||
ECMA_OBJECT_TYPE_GENERAL,
|
||||
@@ -405,9 +405,9 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY,
|
||||
true,
|
||||
uint8clampedarray)
|
||||
|
||||
#endif /* !CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_PROMISE_BUILTIN
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_PROMISE)
|
||||
|
||||
BUILTIN (ECMA_BUILTIN_ID_PROMISE_PROTOTYPE,
|
||||
ECMA_OBJECT_TYPE_GENERAL,
|
||||
@@ -421,9 +421,9 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_PROMISE,
|
||||
true,
|
||||
promise)
|
||||
|
||||
#endif /* !CONFIG_DISABLE_ES2015_PROMISE_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_MAP_BUILTIN
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_MAP)
|
||||
|
||||
/* The Map prototype object (23.1.3) */
|
||||
BUILTIN (ECMA_BUILTIN_ID_MAP_PROTOTYPE,
|
||||
@@ -439,9 +439,9 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_MAP,
|
||||
true,
|
||||
map)
|
||||
|
||||
#endif /* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_MAP) */
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_SYMBOL_BUILTIN
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
|
||||
|
||||
/* The Symbol prototype object (ECMA-262 v6, 19.4.2.7) */
|
||||
BUILTIN (ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE,
|
||||
@@ -457,8 +457,8 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SYMBOL,
|
||||
true,
|
||||
symbol)
|
||||
|
||||
#endif /* !CONFIG_DISABLE_ES2015_SYMBOL_BUILTIN */
|
||||
#ifndef CONFIG_DISABLE_ES2015_ITERATOR_BUILTIN
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR)
|
||||
/* The %IteratorPrototype% object (ECMA-262 v6, 25.1.2) */
|
||||
BUILTIN (ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE,
|
||||
ECMA_OBJECT_TYPE_GENERAL,
|
||||
@@ -472,7 +472,7 @@ BUILTIN (ECMA_BUILTIN_ID_ARRAY_ITERATOR_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE,
|
||||
true,
|
||||
array_iterator_prototype)
|
||||
#endif /* !CONFIG_DISABLE_ES2015_ITERATOR_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */
|
||||
|
||||
/* The Global object (15.1) */
|
||||
BUILTIN (ECMA_BUILTIN_ID_GLOBAL,
|
||||
|
||||
Reference in New Issue
Block a user