Add grouping macro guards for disabling engine features (#2084)
Until now, the engine's feature set was configurable either via `CONFIG_*` macro guards defined individually on compiler command line or via profiles (which are text files listing macro guards, picked up by the cmake build system and turning them into compiler command line options). And the features under profile control are all enabled by default (i.e., all macros are `CONFIG_DISABLE_*`). This causes a maintenance issue when new features are added to the engine, because the disabling macros have to be added to all profiles that don't include the new features. This can even cause "compatibility break" for applications that embed JerryScript but don't use the cmake or the python build system, because then profiles are unavailable and all feature disabling guards have to be explicitly passed to the compiler. (I.e., if such an application wants to use the ES5.1 feature set, it must define all the ES2015 disable macros; if the engine is developed further and a new ES2015 feature gets implemented, then the new feature will sneak into the application's binary unless its own build system is changed to add the new feature guard.) Even the in-repo example Curie BSP target seems to have suffered from this maintenance problem. This patch introduces two new grouping macro guards that enable the disabling of all ES5.1 builtins and all ES2015 features. As the grouping logic is in config.h, the maintenance of non-cmake-based build systems becomes easier (and there is no change for the python and cmake-based build systems). JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -16,6 +16,33 @@
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
/**
|
||||
* Group of builtin-related features that can be disabled together.
|
||||
*/
|
||||
#ifdef CONFIG_DISABLE_BUILTINS
|
||||
# define CONFIG_DISABLE_ANNEXB_BUILTIN
|
||||
# define CONFIG_DISABLE_ARRAY_BUILTIN
|
||||
# define CONFIG_DISABLE_BOOLEAN_BUILTIN
|
||||
# define CONFIG_DISABLE_DATE_BUILTIN
|
||||
# define CONFIG_DISABLE_ERROR_BUILTINS
|
||||
# define CONFIG_DISABLE_JSON_BUILTIN
|
||||
# define CONFIG_DISABLE_MATH_BUILTIN
|
||||
# define CONFIG_DISABLE_NUMBER_BUILTIN
|
||||
# define CONFIG_DISABLE_REGEXP_BUILTIN
|
||||
# define CONFIG_DISABLE_STRING_BUILTIN
|
||||
#endif /* CONFIG_DISABLE_BUILTINS */
|
||||
|
||||
/**
|
||||
* Group of ES2015-related features that can be disabled together.
|
||||
*/
|
||||
#ifdef CONFIG_DISABLE_ES2015
|
||||
# define CONFIG_DISABLE_ES2015_ARROW_FUNCTION
|
||||
# define CONFIG_DISABLE_ES2015_BUILTIN
|
||||
# define CONFIG_DISABLE_ES2015_PROMISE_BUILTIN
|
||||
# define CONFIG_DISABLE_ES2015_TEMPLATE_STRINGS
|
||||
# define CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN
|
||||
#endif /* CONFIG_DISABLE_ES2015 */
|
||||
|
||||
/**
|
||||
* Limit of data (system heap, engine's data except engine's own heap)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user