Browse Source

Merge pull request #550 from svaarala/fix-opt-packed-tval-handling

Fix feature option defaults when already provided
pull/556/head
Sami Vaarala 9 years ago
parent
commit
c8d3e3691b
  1. 4
      RELEASES.rst
  2. 2
      config/config-options/DUK_USE_ALIGN_BY.yaml
  3. 6
      config/config-options/DUK_USE_EXAMPLE.yaml
  4. 5
      config/config-options/DUK_USE_PACKED_TVAL.yaml
  5. 1
      config/config-options/DUK_USE_SETJMP.yaml
  6. 1
      config/config-options/DUK_USE_SIGSETJMP.yaml
  7. 1
      config/config-options/DUK_USE_UNDERSCORE_SETJMP.yaml
  8. 18
      config/genconfig.py

4
RELEASES.rst

@ -1381,6 +1381,10 @@ Planned
exotic pointer models by avoiding arithmetic and binary operations on
(u)intptr_t values (GH-530, GH-539)
* Fix a genconfig legacy feature option bug in Duktape 1.4.0 which caused
DUK_USE_PACKED_TVAL to default to false unless forced using
DUK_OPT_PACKED_TVAL (GH-550)
2.0.0 (XXXX-XX-XX)
------------------

2
config/config-options/DUK_USE_ALIGN_BY.yaml

@ -1,5 +1,4 @@
define: DUK_USE_ALIGN_BY
# FIXME: resolve wrapper
feature_snippet: |
#if !defined(DUK_USE_ALIGN_BY)
#if defined(DUK_OPT_FORCE_ALIGN)
@ -8,6 +7,7 @@ feature_snippet: |
#define DUK_USE_ALIGN_BY 8
#endif
#endif
feature_no_default: true # provided by architecture unless forced
introduced: 1.3.0
default: 8
tags:

6
config/config-options/DUK_USE_EXAMPLE.yaml

@ -30,6 +30,12 @@ related_feature_defines:
# #endif
# #endif
# Feature default value is provided by platform, compiler, or architecture.
# DUK_OPT_xxx handling can force the value if explicitly requested by
# DUK_OPT_XXX or DUK_OPT_NO_xxx, but if neither is given, don't emit a
# default.
#feature_no_default: true
# Duktape version number where this option was first introduced.
introduced: 1.1.0

5
config/config-options/DUK_USE_PACKED_TVAL.yaml

@ -1,9 +1,6 @@
define: DUK_USE_PACKED_TVAL
feature_enables: DUK_OPT_PACKED_TVAL
# FIXME: current snippet is actually:
#if defined(DUK_USE_PACKED_TVAL_POSSIBLE) && !defined(DUK_OPT_NO_PACKED_TVAL)
#define DUK_USE_PACKED_TVAL
#endif
feature_no_default: true # provided by architecture unless forced
introduced: 1.0.0
default: false
tags:

1
config/config-options/DUK_USE_SETJMP.yaml

@ -1,5 +1,6 @@
define: DUK_USE_SETJMP
feature_enables: DUK_OPT_SETJMP
feature_no_default: true # provided by platform unless forced
introduced: 1.1.0
default: true
tags:

1
config/config-options/DUK_USE_SIGSETJMP.yaml

@ -1,5 +1,6 @@
define: DUK_USE_SIGSETJMP
feature_enables: DUK_OPT_SIGSETJMP
feature_no_default: true # provided by platform unless forced
introduced: 1.1.0
default: false
tags:

1
config/config-options/DUK_USE_UNDERSCORE_SETJMP.yaml

@ -1,5 +1,6 @@
define: DUK_USE_UNDERSCORE_SETJMP
feature_enables: DUK_OPT_UNDERSCORE_SETJMP
feature_no_default: true # provided by platform unless forced
introduced: 1.1.0
default: false
tags:

18
config/genconfig.py

@ -927,7 +927,7 @@ def add_override_defines_section(opts, ret):
# Add automatic DUK_OPT_XXX and DUK_OPT_NO_XXX handling for backwards
# compatibility with Duktape 1.2 and before.
def add_feature_option_handling(opts, ret, forced_opts):
def add_feature_option_handling(opts, ret, forced_opts, already_provided_keys):
ret.chdr_block_heading('Feature option handling')
for doc in get_use_defs(removed=False, deprecated=False, unused=False):
@ -962,7 +962,18 @@ def add_feature_option_handling(opts, ret, forced_opts):
ret.line('#undef %s' % config_define)
ret.line('#else')
undef_done = False
emit_default_from_config_meta(ret, doc, forced_opts, undef_done)
# For some options like DUK_OPT_PACKED_TVAL the default comes
# from platform definition.
if doc.get('feature_no_default', False):
print('Skip default for option %s' % config_define)
ret.line('/* Already provided above */')
elif already_provided_keys.has_key(config_define):
# This is a fallback in case config option metadata is wrong.
print('Skip default for option %s (already provided but not flagged in metadata!)' % config_define)
ret.line('/* Already provided above */')
else:
emit_default_from_config_meta(ret, doc, forced_opts, undef_done)
ret.line('#endif')
elif doc.has_key('feature_snippet'):
ret.lines(doc['feature_snippet'])
@ -1294,7 +1305,8 @@ def generate_duk_config_header(opts, meta_dir):
# Automatic DUK_OPT_xxx feature option handling
if opts.support_feature_options:
print('Autogenerating feature option (DUK_OPT_xxx) support')
add_feature_option_handling(opts, ret, forced_opts)
tmp = Snippet(ret.join().split('\n'))
add_feature_option_handling(opts, ret, forced_opts, tmp.provides)
# Emit forced options. If a corresponding option is already defined
# by a snippet above, #undef it first.

Loading…
Cancel
Save