1/* Copyright JS Foundation and other contributors, http://js.foundation
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef JERRYSCRIPT_CONFIG_H
17#define JERRYSCRIPT_CONFIG_H
18
19/*
20 * Here define the special config for IAR and gn build.
21 */
22#if (!defined(_WIN32) && !defined(_WIN64))
23#ifndef JERRY_BUILTIN_REGEXP
24# define JERRY_BUILTIN_REGEXP 0
25#endif
26
27#ifndef JERRY_ES2015
28# define JERRY_ES2015 0
29#endif
30
31#ifndef JERRY_NDEBUG
32# define JERRY_NDEBUG
33#endif
34
35#ifndef JERRY_DISABLE_HEAVY_DEBUG
36# define JERRY_DISABLE_HEAVY_DEBUG
37#endif
38
39#ifndef JERRY_SNAPSHOT_EXEC
40# define JERRY_SNAPSHOT_EXEC 1
41#endif
42
43#ifndef JERRY_PARSER
44# define JERRY_PARSER 1
45#endif
46
47#ifndef JERRY_ES2015_BUILTIN_TYPEDARRAY
48# define JERRY_ES2015_BUILTIN_TYPEDARRAY 1
49#endif
50
51#ifndef JERRY_FOR_IAR_CONFIG
52#ifndef JERRY_MEM_STATS
53# define JERRY_MEM_STATS 1
54#endif
55
56#ifndef JERRY_LOGGING
57# define JERRY_LOGGING 1
58#endif
59#endif /* JERRY_FOR_IAR_CONFIG */
60
61#ifndef JERRY_GLOBAL_HEAP_SIZE
62//Maximum size of heap in kilobytes
63# define JERRY_GLOBAL_HEAP_SIZE (48)
64#endif
65
66#ifndef JERRY_BUILTIN_EVAL_DISABLED
67// disable builtin eval() function
68# define JERRY_BUILTIN_EVAL_DISABLED 1
69#endif
70
71#if defined (__linux__)
72#ifndef JERRY_SNAPSHOT_SAVE
73# define JERRY_SNAPSHOT_SAVE 1
74#endif
75#endif /* binary tool compiling in linux platform */
76
77#endif /* !defined(_WIN32) && !defined(_WIN64) */
78
79/*
80 * Here define the special config for Win simulator build.
81 */
82#if defined (_WIN32) || defined (_WIN64)
83#ifdef JERRY_FOR_IAR_CONFIG
84# error "Should not define this macro on WIN simulator!"
85#endif
86#ifndef JERRY_BUILTIN_REGEXP
87# define JERRY_BUILTIN_REGEXP 0
88#endif
89
90#ifndef JERRY_ES2015
91# define JERRY_ES2015 0
92#endif
93
94#ifndef JERRY_ES2015_BUILTIN_TYPEDARRAY
95# define JERRY_ES2015_BUILTIN_TYPEDARRAY 1
96#endif
97
98//Maximum size of heap in kilobytes
99#ifndef JERRY_GLOBAL_HEAP_SIZE
100# define JERRY_GLOBAL_HEAP_SIZE (64)
101#endif
102
103#ifndef JERRY_DISABLE_HEAVY_DEBUG
104# define JERRY_DISABLE_HEAVY_DEBUG
105#endif
106
107#ifndef JERRY_ERROR_MESSAGES
108# define JERRY_ERROR_MESSAGES 1
109#endif
110
111#ifndef JERRY_LINE_INFO
112# define JERRY_LINE_INFO 1
113#endif
114
115#ifndef JERRY_MEM_STATS
116# define JERRY_MEM_STATS 1
117#endif
118
119#ifndef JERRY_SNAPSHOT_EXEC
120# define JERRY_SNAPSHOT_EXEC 1
121#endif
122
123#ifndef JERRY_SNAPSHOT_SAVE
124# define JERRY_SNAPSHOT_SAVE 1
125#endif
126
127#ifndef JERRY_LOGGING
128# define JERRY_LOGGING 1
129#endif
130
131// following config controls temp changes in jerry for debugger function with IDE
132#ifndef ACE_DEBUGGER_CUSTOM
133# define ACE_DEBUGGER_CUSTOM
134#endif
135
136#ifndef JERRY_BUILTIN_EVAL_DISABLED
137// disable builtin eval() function
138# define JERRY_BUILTIN_EVAL_DISABLED 1
139#endif
140#endif /* defined (_WIN32) || defined (_WIN64) */
141
142/*
143 * Note: should not modify below by default!
144 */
145
146// @JERRY_BUILD_CFG@
147
148/**
149 * Built-in configurations
150 *
151 * Allowed values for built-in defines:
152 *  0: Disable the given built-in.
153 *  1: Enable the given built-in.
154 */
155/*
156 * By default all built-ins are enabled if they are not defined.
157 */
158#ifndef JERRY_BUILTINS
159# define JERRY_BUILTINS 1
160#endif /* !defined (JERRY_BUILTINS) */
161
162#ifndef JERRY_BUILTIN_ANNEXB
163# define JERRY_BUILTIN_ANNEXB JERRY_BUILTINS
164#endif /* !defined (JERRY_BUILTIN_ANNEXB) */
165
166#ifndef JERRY_BUILTIN_ARRAY
167# define JERRY_BUILTIN_ARRAY JERRY_BUILTINS
168#endif /* !defined (JERRY_BUILTIN_ARRAY) */
169
170#ifndef JERRY_BUILTIN_DATE
171# define JERRY_BUILTIN_DATE JERRY_BUILTINS
172#endif /* !defined (JERRY_BUILTIN_DATE) */
173
174#ifndef JERRY_BUILTIN_ERRORS
175# define JERRY_BUILTIN_ERRORS JERRY_BUILTINS
176#endif /* !defined (JERRY_BUILTIN_ERRORS) */
177
178#ifndef JERRY_BUILTIN_BOOLEAN
179# define JERRY_BUILTIN_BOOLEAN JERRY_BUILTINS
180#endif /* !defined (JERRY_BUILTIN_BOOLEAN) */
181
182#ifndef JERRY_BUILTIN_JSON
183# define JERRY_BUILTIN_JSON JERRY_BUILTINS
184#endif /* !defined (JERRY_BUILTIN_JSON) */
185
186#ifndef JERRY_BUILTIN_MATH
187# define JERRY_BUILTIN_MATH JERRY_BUILTINS
188#endif /* !defined (JERRY_BUILTIN_MATH) */
189
190#ifndef JERRY_BUILTIN_NUMBER
191# define JERRY_BUILTIN_NUMBER JERRY_BUILTINS
192#endif /* !defined (JERRY_BUILTIN_NUMBER) */
193
194#ifndef JERRY_BUILTIN_REGEXP
195# define JERRY_BUILTIN_REGEXP JERRY_BUILTINS
196#endif /* !defined (JERRY_BUILTIN_REGEXP) */
197
198#ifndef JERRY_BUILTIN_STRING
199# define JERRY_BUILTIN_STRING JERRY_BUILTINS
200#endif /* !defined (JERRY_BUILTIN_STRING) */
201
202/**
203 * ES2015 (a.k.a es6) related features, by default all of them are enabled.
204 */
205#ifndef JERRY_ES2015
206# define JERRY_ES2015 1
207#endif /* !defined (JERRY_ES2015) */
208
209#ifndef JERRY_ES2015_BUILTIN_DATAVIEW
210# define JERRY_ES2015_BUILTIN_DATAVIEW JERRY_ES2015
211#endif /* !defined (JERRY_ES2015_BUILTIN_DATAVIEW) */
212
213#ifndef JERRY_ES2015_BUILTIN_MAP
214# define JERRY_ES2015_BUILTIN_MAP JERRY_ES2015
215#endif /* !defined (JERRY_ES2015_BUILTIN_MAP) */
216
217#ifndef JERRY_ES2015_BUILTIN_SET
218# define JERRY_ES2015_BUILTIN_SET JERRY_ES2015
219#endif /* !defined (JERRY_ES2015_BUILTIN_SET) */
220
221#ifndef JERRY_ES2015_BUILTIN_WEAKMAP
222# define JERRY_ES2015_BUILTIN_WEAKMAP JERRY_ES2015
223#endif /* !defined (JERRY_ES2015_BUILTIN_WEAKMAP) */
224
225#ifndef JERRY_ES2015_BUILTIN_WEAKSET
226# define JERRY_ES2015_BUILTIN_WEAKSET JERRY_ES2015
227#endif /* !defined (JERRY_ES2015_BUILTIN_WEAKSET) */
228
229#ifndef JERRY_ES2015_BUILTIN_PROMISE
230# define JERRY_ES2015_BUILTIN_PROMISE JERRY_ES2015
231#endif /* !defined (JERRY_ES2015_BUILTIN_PROMISE) */
232
233#ifndef JERRY_ES2015_BUILTIN_PROXY
234# define JERRY_ES2015_BUILTIN_PROXY JERRY_ES2015
235#endif /* !defined (JERRY_ES2015_BUILTIN_PROXY) */
236
237#ifndef JERRY_ES2015_BUILTIN_REFLECT
238# define JERRY_ES2015_BUILTIN_REFLECT JERRY_ES2015
239#endif /* !defined (JERRY_ES2015_BUILTIN_REFLECT) */
240
241#ifndef JERRY_ES2015_BUILTIN_TYPEDARRAY
242# define JERRY_ES2015_BUILTIN_TYPEDARRAY JERRY_ES2015
243#endif /* !defined (JERRY_ES2015_BUILTIN_TYPEDARRAY) */
244
245#ifndef JERRY_ES2015_MODULE_SYSTEM
246# define JERRY_ES2015_MODULE_SYSTEM JERRY_ES2015
247#endif /* !defined (JERRY_ES2015_MODULE_SYSTEM) */
248
249/**
250 * Engine internal and misc configurations.
251 */
252
253/**
254 * Specifies the compressed pointer representation
255 *
256 * Allowed values:
257 *  0: use 16 bit representation
258 *  1: use 32 bit representation
259 *
260 * Default value: 0
261 * For more details see: jmem/jmem.h
262 */
263#ifndef JERRY_CPOINTER_32_BIT
264# define JERRY_CPOINTER_32_BIT 0
265#endif /* !defined (JERRY_CPOINTER_32_BIT) */
266
267/**
268 * Enable/Disable the engine's JavaScript debugger interface
269 *
270 * Allowed values:
271 *  0: Disable the debugger parts.
272 *  1: Enable the debugger.
273 */
274#ifndef JERRY_DEBUGGER
275# define JERRY_DEBUGGER 0
276#endif /* !defined (JERRY_DEBUGGER) */
277
278/**
279 * Enable/Disable built-in error messages for error objects.
280 *
281 * Allowed values:
282 *  0: Disable error messages.
283 *  1: Enable error message.
284 *
285 * Default value: 0
286 */
287#ifndef JERRY_ERROR_MESSAGES
288# define JERRY_ERROR_MESSAGES 0
289#endif /* !defined (JERRY_ERROR_MESSAGES) */
290
291/**
292 * Enable/Disable external context.
293 *
294 * Allowed values:
295 *  0: Disable external context.
296 *  1: Enable external context support.
297 *
298 * Default value: 0
299 */
300#ifndef JERRY_EXTERNAL_CONTEXT
301# define JERRY_EXTERNAL_CONTEXT 0
302#endif /* !defined (JERRY_EXTERNAL_CONTEXT) */
303
304/**
305 * Maximum size of heap in kilobytes
306 *
307 * Default value: 512 KiB
308 */
309#ifndef JERRY_GLOBAL_HEAP_SIZE
310# define JERRY_GLOBAL_HEAP_SIZE (512)
311#endif /* !defined (JERRY_GLOBAL_HEAP_SIZE) */
312
313/**
314 * The allowed heap usage limit until next garbage collection, in bytes.
315 *
316 * If value is 0, the default is 1/32 of JERRY_HEAP_SIZE
317 */
318#ifndef JERRY_GC_LIMIT
319# define JERRY_GC_LIMIT 0
320#endif /* !defined (JERRY_GC_LIMIT) */
321
322/**
323 * Maximum stack usage size in kilobytes
324 *
325 * Note: This feature cannot be used when 'detect_stack_use_after_return=1' ASAN option is enabled.
326 * For more detailed description:
327 *   - https://github.com/google/sanitizers/wiki/AddressSanitizerUseAfterReturn#compatibility
328 *
329 * Default value: 0, unlimited
330 */
331#ifndef JERRY_STACK_LIMIT
332# define JERRY_STACK_LIMIT (0)
333#endif /* !defined (JERRY_STACK_LIMIT) */
334
335/**
336 * Maximum depth of recursion during GC mark phase
337 *
338 * Default value: 8
339 */
340#ifndef JERRY_GC_MARK_LIMIT
341# define JERRY_GC_MARK_LIMIT (8)
342#endif /* !defined (JERRY_GC_MARK_LIMIT) */
343
344/**
345 * Enable/Disable property lookup cache.
346 *
347 * Allowed values:
348 *  0: Disable lookup cache.
349 *  1: Enable lookup cache.
350 *
351 * Default value: 1
352 */
353#ifndef JERRY_LCACHE
354# define JERRY_LCACHE 1
355#endif /* !defined (JERRY_LCACHE) */
356
357/**
358 * Enable/Disable line-info management inside the engine.
359 *
360 * Allowed values:
361 *  0: Disable line-info in the engine.
362 *  1: Enable line-info management.
363 *
364 * Default value: 0
365 */
366#ifndef JERRY_LINE_INFO
367# define JERRY_LINE_INFO 0
368#endif /* !defined (JERRY_LINE_INFO) */
369
370/**
371 * Enable/Disable logging inside the engine.
372 *
373 * Allowed values:
374 *  0: Disable internal logging.
375 *  1: Enable internal logging.
376 *
377 * Default value: 0
378 */
379#ifndef JERRY_LOGGING
380# define JERRY_LOGGING 0
381#endif /* !defined (JERRY_LOGGING) */
382
383/**
384 * Enable/Disable gc call before every allocation.
385 *
386 * Allowed values:
387 *  0: Disable gc call before each allocation.
388 *  1: Enable and force gc call before each allocation.
389 *
390 * Default value: 0
391 * Warning!: This is an advanced option and will slow down the engine!
392 *           Only enable it for debugging purposes.
393 */
394#ifndef JERRY_MEM_GC_BEFORE_EACH_ALLOC
395# define JERRY_MEM_GC_BEFORE_EACH_ALLOC 0
396#endif /* !defined (JERRY_MEM_GC_BEFORE_EACH_ALLOC) */
397
398/**
399 * Enable/Disable the collection if run-time memory statistics.
400 *
401 * Allowed values:
402 *  0: Disable run-time memory information collection.
403 *  1: Enable run-time memory statistics collection.
404 *
405 * Default value: 0
406 */
407#ifndef JERRY_MEM_STATS
408# define JERRY_MEM_STATS 0
409#endif /* !defined (JERRY_MEM_STATS) */
410
411/**
412 * Use 32-bit/64-bit float for ecma-numbers
413 * This option is for expert use only!
414 *
415 * Allowed values:
416 *  1: use 64-bit floating point number mode
417 *  0: use 32-bit floating point number mode
418 *
419 * Default value: 1
420 */
421#ifndef JERRY_NUMBER_TYPE_FLOAT64
422# define JERRY_NUMBER_TYPE_FLOAT64 1
423#endif /* !defined (JERRY_NUMBER_TYPE_FLOAT64 */
424
425/**
426 * Enable/Disable the JavaScript parser.
427 *
428 * Allowed values:
429 *  0: Disable the JavaScript parser and all related functionallity.
430 *  1: Enable the JavaScript parser.
431 *
432 * Default value: 1
433 */
434#ifndef JERRY_PARSER
435# define JERRY_PARSER 1
436#endif /* !defined (JERRY_PARSER) */
437
438/**
439 * Enable/Disable JerryScript byte code dump functions during parsing.
440 * To dump the JerryScript byte code the engine must be initialized with opcodes
441 * display flag. This option does not influence RegExp byte code dumps.
442 *
443 * Allowed values:
444 *  0: Disable all bytecode dump functions.
445 *  1: Enable bytecode dump functions.
446 *
447 * Default value: 0
448 */
449#ifndef JERRY_PARSER_DUMP_BYTE_CODE
450# define JERRY_PARSER_DUMP_BYTE_CODE 0
451#endif /* defined (JERRY_PARSER_DUMP_BYTE_CODE) */
452
453/**
454 * Enable/Disable ECMA property hashmap.
455 *
456 * Allowed values:
457 *  0: Disable property hasmap.
458 *  1: Enable property hashmap.
459 *
460 * Default value: 1
461 */
462#ifndef JERRY_PROPRETY_HASHMAP
463# define JERRY_PROPRETY_HASHMAP 1
464#endif /* !defined (JERRY_PROPRETY_HASHMAP) */
465
466/**
467 * Enable/Disable byte code dump functions for RegExp objects.
468 * To dump the RegExp byte code the engine must be initialized with
469 * regexp opcodes display flag. This option does not influence the
470 * JerryScript byte code dumps.
471 *
472 * Allowed values:
473 *  0: Disable all bytecode dump functions.
474 *  1: Enable bytecode dump functions.
475 *
476 * Default value: 0
477 */
478#ifndef JERRY_REGEXP_DUMP_BYTE_CODE
479# define JERRY_REGEXP_DUMP_BYTE_CODE 0
480#endif /* !defined (JERRY_REGEXP_DUMP_BYTE_CODE) */
481
482/**
483 * Enables/disables the RegExp strict mode
484 *
485 * Default value: 0
486 */
487#ifndef JERRY_REGEXP_STRICT_MODE
488# define JERRY_REGEXP_STRICT_MODE 0
489#endif /* !defined (JERRY_REGEXP_STRICT_MODE) */
490
491/**
492 * Enable/Disable the snapshot execution functions.
493 *
494 * Allowed values:
495 *  0: Disable snapshot execution.
496 *  1: Enable snapshot execution.
497 *
498 * Default value: 0
499 */
500#ifndef JERRY_SNAPSHOT_EXEC
501# define JERRY_SNAPSHOT_EXEC 0
502#endif /* !defined (JERRY_SNAPSHOT_EXEC) */
503
504/**
505 * Enable/Disable the snapshot save functions.
506 *
507 * Allowed values:
508 *  0: Disable snapshot save functions.
509 *  1: Enable snapshot save functions.
510 */
511#ifndef JERRY_SNAPSHOT_SAVE
512# define JERRY_SNAPSHOT_SAVE 0
513#endif /* !defined (JERRY_SNAPSHOT_SAVE) */
514
515/**
516 * Enable/Disable usage of system allocator.
517 *
518 * Allowed values:
519 *  0: Disable usage of system allocator.
520 *  1: Enable usage of system allocator.
521 *
522 * Default value: 0
523 */
524#ifndef JERRY_SYSTEM_ALLOCATOR
525# define JERRY_SYSTEM_ALLOCATOR 0
526#endif /* !defined (JERRY_SYSTEM_ALLOCATOR) */
527
528/**
529 * Enables/disables the unicode case conversion in the engine.
530 * By default Unicode case conversion is enabled.
531 */
532#ifndef JERRY_UNICODE_CASE_CONVERSION
533# define JERRY_UNICODE_CASE_CONVERSION 1
534#endif /* !defined (JERRY_UNICODE_CASE_CONVERSION) */
535
536/**
537 * Configures if the internal memory allocations are exposed to Valgrind or not.
538 *
539 * Allowed values:
540 *  0: Disable the Valgrind specific memory allocation notifications.
541 *  1: Enable the Valgrind specific allocation notifications.
542 */
543#ifndef JERRY_VALGRIND
544# define JERRY_VALGRIND 0
545#endif /* !defined (JERRY_VALGRIND) */
546
547/**
548 * Enable/Disable the vm execution stop callback function.
549 *
550 * Allowed values:
551 *  0: Disable vm exec stop callbacks.
552 *  1: Enable vm exec stop callback functionality.
553 */
554#ifndef JERRY_VM_EXEC_STOP
555# define JERRY_VM_EXEC_STOP 0
556#endif /* !defined (JERRY_VM_EXEC_STOP) */
557
558/**
559 * Advanced section configurations.
560 */
561
562/**
563 * Allow configuring attributes on a few constant data inside the engine.
564 *
565 * One of the main usages:
566 * Normally compilers store const(ant)s in ROM. Thus saving RAM.
567 * But if your compiler does not support it then the directive below can force it.
568 *
569 * For the moment it is mainly meant for the following targets:
570 *      - ESP8266
571 *
572 * Example configuration for moving (some) constatns into a given section:
573 *  # define JERRY_ATTR_CONST_DATA __attribute__((section(".rodata.const")))
574 */
575#ifndef JERRY_ATTR_CONST_DATA
576# define JERRY_ATTR_CONST_DATA
577#endif /* !defined (JERRY_ATTR_CONST_DATA) */
578
579/**
580 * The JERRY_ATTR_GLOBAL_HEAP allows adding extra attributes for the Jerry global heap.
581 *
582 * Example on how to move the global heap into it's own section:
583 *   #define JERRY_ATTR_GLOBAL_HEAP __attribute__((section(".text.globalheap")))
584 */
585#ifndef JERRY_ATTR_GLOBAL_HEAP
586# define JERRY_ATTR_GLOBAL_HEAP
587#endif /* !defined (JERRY_ATTR_GLOBAL_HEAP) */
588
589/**
590 * Sanity check for macros to see if the values are 0 or 1
591 *
592 * If a new feature is added this should be updated.
593 */
594/**
595 * Check base builtins.
596 */
597#if !defined (JERRY_BUILTIN_ANNEXB) \
598|| ((JERRY_BUILTIN_ANNEXB != 0) && (JERRY_BUILTIN_ANNEXB != 1))
599# error "Invalid value for JERRY_BUILTIN_ANNEXB macro."
600#endif
601#if !defined (JERRY_BUILTIN_ARRAY) \
602|| ((JERRY_BUILTIN_ARRAY != 0) && (JERRY_BUILTIN_ARRAY != 1))
603# error "Invalid value for JERRY_BUILTIN_ARRAY macro."
604#endif
605#if !defined (JERRY_BUILTIN_BOOLEAN) \
606|| ((JERRY_BUILTIN_BOOLEAN != 0) && (JERRY_BUILTIN_BOOLEAN != 1))
607# error "Invalid value for JERRY_BUILTIN_BOOLEAN macro."
608#endif
609#if !defined (JERRY_BUILTIN_DATE) \
610|| ((JERRY_BUILTIN_DATE != 0) && (JERRY_BUILTIN_DATE != 1))
611# error "Invalid value for JERRY_BUILTIN_DATE macro."
612#endif
613#if !defined (JERRY_BUILTIN_ERRORS) \
614|| ((JERRY_BUILTIN_ERRORS != 0) && (JERRY_BUILTIN_ERRORS != 1))
615# error "Invalid value for JERRY_BUILTIN_ERRORS macro."
616#endif
617#if !defined (JERRY_BUILTIN_JSON) \
618|| ((JERRY_BUILTIN_JSON != 0) && (JERRY_BUILTIN_JSON != 1))
619# error "Invalid value for JERRY_BUILTIN_JSON macro."
620#endif
621#if !defined (JERRY_BUILTIN_MATH) \
622|| ((JERRY_BUILTIN_MATH != 0) && (JERRY_BUILTIN_MATH != 1))
623# error "Invalid value for JERRY_BUILTIN_MATH macro."
624#endif
625#if !defined (JERRY_BUILTIN_NUMBER) \
626|| ((JERRY_BUILTIN_NUMBER != 0) && (JERRY_BUILTIN_NUMBER != 1))
627# error "Invalid value for JERRY_BUILTIN_NUMBER macro."
628#endif
629#if !defined (JERRY_BUILTIN_REGEXP) \
630|| ((JERRY_BUILTIN_REGEXP != 0) && (JERRY_BUILTIN_REGEXP != 1))
631# error "Invalid value for JERRY_BUILTIN_REGEXP macro."
632#endif
633#if !defined (JERRY_BUILTIN_STRING) \
634|| ((JERRY_BUILTIN_STRING != 0) && (JERRY_BUILTIN_STRING != 1))
635# error "Invalid value for JERRY_BUILTIN_STRING macro."
636#endif
637#if !defined (JERRY_BUILTINS) \
638|| ((JERRY_BUILTINS != 0) && (JERRY_BUILTINS != 1))
639# error "Invalid value for JERRY_BUILTINS macro."
640#endif
641
642/**
643 * Check ES2015 features
644 */
645#if !defined (JERRY_ES2015) \
646|| ((JERRY_ES2015 != 0) && (JERRY_ES2015 != 1))
647# error "Invalid value for JERRY_ES2015 macro."
648#endif
649#if !defined (JERRY_ES2015_BUILTIN_DATAVIEW) \
650|| ((JERRY_ES2015_BUILTIN_DATAVIEW != 0) && (JERRY_ES2015_BUILTIN_DATAVIEW != 1))
651# error "Invalid value for JERRY_ES2015_BUILTIN_DATAVIEW macro."
652#endif
653#if !defined (JERRY_ES2015_BUILTIN_MAP) \
654|| ((JERRY_ES2015_BUILTIN_MAP != 0) && (JERRY_ES2015_BUILTIN_MAP != 1))
655# error "Invalid value for JERRY_ES2015_BUILTIN_MAP macro."
656#endif
657#if !defined (JERRY_ES2015_BUILTIN_REFLECT) \
658|| ((JERRY_ES2015_BUILTIN_REFLECT != 0) && (JERRY_ES2015_BUILTIN_REFLECT != 1))
659# error "Invalid value for JERRY_ES2015_BUILTIN_REFLECT macro."
660#endif
661#if !defined (JERRY_ES2015_BUILTIN_SET) \
662|| ((JERRY_ES2015_BUILTIN_SET != 0) && (JERRY_ES2015_BUILTIN_SET != 1))
663# error "Invalid value for JERRY_ES2015_BUILTIN_SET macro."
664#endif
665#if !defined (JERRY_ES2015_BUILTIN_WEAKMAP) \
666|| ((JERRY_ES2015_BUILTIN_WEAKMAP != 0) && (JERRY_ES2015_BUILTIN_WEAKMAP != 1))
667# error "Invalid value for JERRY_ES2015_BUILTIN_WEAKMAP macro."
668#endif
669#if !defined (JERRY_ES2015_BUILTIN_WEAKSET) \
670|| ((JERRY_ES2015_BUILTIN_WEAKSET != 0) && (JERRY_ES2015_BUILTIN_WEAKSET != 1))
671# error "Invalid value for JERRY_ES2015_BUILTIN_WEAKSET macro."
672#endif
673#if !defined (JERRY_ES2015_BUILTIN_PROMISE) \
674|| ((JERRY_ES2015_BUILTIN_PROMISE != 0) && (JERRY_ES2015_BUILTIN_PROMISE != 1))
675# error "Invalid value for JERRY_ES2015_BUILTIN_PROMISE macro."
676#endif
677#if !defined (JERRY_ES2015_BUILTIN_PROXY) \
678|| ((JERRY_ES2015_BUILTIN_PROXY != 0) && (JERRY_ES2015_BUILTIN_PROXY != 1))
679# error "Invalid value for JERRY_ES2015_BUILTIN_PROXY macro."
680#endif
681#if !defined (JERRY_ES2015_BUILTIN_TYPEDARRAY) \
682|| ((JERRY_ES2015_BUILTIN_TYPEDARRAY != 0) && (JERRY_ES2015_BUILTIN_TYPEDARRAY != 1))
683# error "Invalid value for JERRY_ES2015_BUILTIN_TYPEDARRAY macro."
684#endif
685#if !defined (JERRY_ES2015_MODULE_SYSTEM) \
686|| ((JERRY_ES2015_MODULE_SYSTEM != 0) && (JERRY_ES2015_MODULE_SYSTEM != 1))
687# error "Invalid value for JERRY_ES2015_MODULE_SYSTEM macro."
688#endif
689
690/**
691 * Internal options.
692 */
693#if !defined (JERRY_CPOINTER_32_BIT) \
694|| ((JERRY_CPOINTER_32_BIT != 0) && (JERRY_CPOINTER_32_BIT != 1))
695# error "Invalid value for 'JERRY_CPOINTER_32_BIT' macro."
696#endif
697#if !defined (JERRY_DEBUGGER) \
698|| ((JERRY_DEBUGGER != 0) && (JERRY_DEBUGGER != 1))
699# error "Invalid value for 'JERRY_DEBUGGER' macro."
700#endif
701#if !defined (JERRY_ERROR_MESSAGES) \
702|| ((JERRY_ERROR_MESSAGES != 0) && (JERRY_ERROR_MESSAGES != 1))
703# error "Invalid value for 'JERRY_ERROR_MESSAGES' macro."
704#endif
705#if !defined (JERRY_EXTERNAL_CONTEXT) \
706|| ((JERRY_EXTERNAL_CONTEXT != 0) && (JERRY_EXTERNAL_CONTEXT != 1))
707# error "Invalid value for 'JERRY_EXTERNAL_CONTEXT' macro."
708#endif
709#if !defined (JERRY_GLOBAL_HEAP_SIZE) || (JERRY_GLOBAL_HEAP_SIZE <= 0)
710# error "Invalid value for 'JERRY_GLOBAL_HEAP_SIZE' macro."
711#endif
712#if !defined (JERRY_GC_LIMIT) || (JERRY_GC_LIMIT < 0)
713# error "Invalid value for 'JERRY_GC_LIMIT' macro."
714#endif
715#if !defined (JERRY_STACK_LIMIT) || (JERRY_STACK_LIMIT < 0)
716# error "Invalid value for 'JERRY_STACK_LIMIT' macro."
717#endif
718#if !defined (JERRY_GC_MARK_LIMIT) || (JERRY_GC_MARK_LIMIT < 0)
719# error "Invalid value for 'JERRY_GC_MARK_LIMIT' macro."
720#endif
721#if !defined (JERRY_LCACHE) \
722|| ((JERRY_LCACHE != 0) && (JERRY_LCACHE != 1))
723# error "Invalid value for 'JERRY_LCACHE' macro."
724#endif
725#if !defined (JERRY_LINE_INFO) \
726|| ((JERRY_LINE_INFO != 0) && (JERRY_LINE_INFO != 1))
727# error "Invalid value for 'JERRY_LINE_INFO' macro."
728#endif
729#if !defined (JERRY_LOGGING) \
730|| ((JERRY_LOGGING != 0) && (JERRY_LOGGING != 1))
731# error "Invalid value for 'JERRY_LOGGING' macro."
732#endif
733#if !defined (JERRY_MEM_GC_BEFORE_EACH_ALLOC) \
734|| ((JERRY_MEM_GC_BEFORE_EACH_ALLOC != 0) && (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 1))
735# error "Invalid value for 'JERRY_MEM_GC_BEFORE_EACH_ALLOC' macro."
736#endif
737#if !defined (JERRY_MEM_STATS) \
738|| ((JERRY_MEM_STATS != 0) && (JERRY_MEM_STATS != 1))
739# error "Invalid value for 'JERRY_MEM_STATS' macro."
740#endif
741#if !defined (JERRY_NUMBER_TYPE_FLOAT64) \
742|| ((JERRY_NUMBER_TYPE_FLOAT64 != 0) && (JERRY_NUMBER_TYPE_FLOAT64 != 1))
743# error "Invalid value for 'JERRY_NUMBER_TYPE_FLOAT64' macro."
744#endif
745#if !defined (JERRY_PARSER) \
746|| ((JERRY_PARSER != 0) && (JERRY_PARSER != 1))
747# error "Invalid value for 'JERRY_PARSER' macro."
748#endif
749#if !defined (JERRY_PARSER_DUMP_BYTE_CODE) \
750|| ((JERRY_PARSER_DUMP_BYTE_CODE != 0) && (JERRY_PARSER_DUMP_BYTE_CODE != 1))
751# error "Invalid value for 'JERRY_PARSER_DUMP_BYTE_CODE' macro."
752#endif
753#if !defined (JERRY_PROPRETY_HASHMAP) \
754|| ((JERRY_PROPRETY_HASHMAP != 0) && (JERRY_PROPRETY_HASHMAP != 1))
755# error "Invalid value for 'JERRY_PROPRETY_HASHMAP' macro."
756#endif
757#if !defined (JERRY_REGEXP_DUMP_BYTE_CODE) \
758|| ((JERRY_REGEXP_DUMP_BYTE_CODE != 0) && (JERRY_REGEXP_DUMP_BYTE_CODE != 1))
759# error "Invalid value for 'JERRY_REGEXP_DUMP_BYTE_CODE' macro."
760#endif
761#if !defined (JERRY_REGEXP_STRICT_MODE) \
762|| ((JERRY_REGEXP_STRICT_MODE != 0) && (JERRY_REGEXP_STRICT_MODE != 1))
763# error "Invalid value for 'JERRY_REGEXP_STRICT_MODE' macro."
764#endif
765#if !defined (JERRY_SNAPSHOT_EXEC) \
766|| ((JERRY_SNAPSHOT_EXEC != 0) && (JERRY_SNAPSHOT_EXEC != 1))
767# error "Invalid value for 'JERRY_SNAPSHOT_EXEC' macro."
768#endif
769#if !defined (JERRY_SNAPSHOT_SAVE) \
770|| ((JERRY_SNAPSHOT_SAVE != 0) && (JERRY_SNAPSHOT_SAVE != 1))
771# error "Invalid value for 'JERRY_SNAPSHOT_SAVE' macro."
772#endif
773#if !defined (JERRY_SYSTEM_ALLOCATOR) \
774|| ((JERRY_SYSTEM_ALLOCATOR != 0) && (JERRY_SYSTEM_ALLOCATOR != 1))
775# error "Invalid value for 'JERRY_SYSTEM_ALLOCATOR' macro."
776#endif
777#if !defined (JERRY_UNICODE_CASE_CONVERSION) \
778|| ((JERRY_UNICODE_CASE_CONVERSION != 0) && (JERRY_UNICODE_CASE_CONVERSION != 1))
779# error "Invalid value for 'JERRY_UNICODE_CASE_CONVERSION' macro."
780#endif
781#if !defined (JERRY_VALGRIND) \
782|| ((JERRY_VALGRIND != 0) && (JERRY_VALGRIND != 1))
783# error "Invalid value for 'JERRY_VALGRIND' macro."
784#endif
785#if !defined (JERRY_VM_EXEC_STOP) \
786|| ((JERRY_VM_EXEC_STOP != 0) && (JERRY_VM_EXEC_STOP != 1))
787# error "Invalid value for 'JERRY_VM_EXEC_STOP' macro."
788#endif
789
790#define ENABLED(FEATURE) ((FEATURE) == 1)
791#define DISABLED(FEATURE) ((FEATURE) != 1)
792
793/**
794 * Cross component requirements check.
795 */
796/**
797 * The date module can only use the float 64 number types.
798 * Do a check for this.
799 */
800#if ENABLED (JERRY_BUILTIN_DATE) && !ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
801#  error "Date does not support float32"
802#endif
803
804/**
805 * Wrap container types into a single guard
806 */
807#if ENABLED (JERRY_ES2015_BUILTIN_MAP) || ENABLED (JERRY_ES2015_BUILTIN_SET) \
808|| ENABLED (JERRY_ES2015_BUILTIN_WEAKMAP) || ENABLED (JERRY_ES2015_BUILTIN_WEAKSET)
809# define JERRY_ES2015_BUILTIN_CONTAINER 1
810#else
811# define JERRY_ES2015_BUILTIN_CONTAINER 0
812#endif
813
814#endif /* !JERRYSCRIPT_CONFIG_H */
815