summaryrefslogtreecommitdiff
path: root/src/options/mkoptions.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/options/mkoptions.py')
-rw-r--r--src/options/mkoptions.py23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/options/mkoptions.py b/src/options/mkoptions.py
index e2c138490..b632b3384 100644
--- a/src/options/mkoptions.py
+++ b/src/options/mkoptions.py
@@ -56,7 +56,7 @@ MODULE_ATTR_ALL = MODULE_ATTR_REQ + ['option']
OPTION_ATTR_REQ = ['category', 'type']
OPTION_ATTR_ALL = OPTION_ATTR_REQ + [
'name', 'help', 'help_mode', 'smt_name', 'short', 'long', 'default',
- 'includes', 'handler', 'predicates', 'read_only',
+ 'includes', 'handler', 'predicates',
'alternate', 'mode'
]
@@ -134,15 +134,6 @@ TPL_OPTION_STRUCT_RW = \
static constexpr const char* name = "{long_name}";
}} thread_local {name};"""
-TPL_OPTION_STRUCT_RO = \
-"""extern struct {name}__option_t
-{{
- typedef {type} type;
- type operator()() const;
- static constexpr const char* name = "{long_name}";
-}} thread_local {name};"""
-
-
TPL_DECL_SET = \
"""template <> options::{name}__option_t::type& Options::ref(
options::{name}__option_t);"""
@@ -260,12 +251,11 @@ class Option(object):
self.__dict__ = dict((k, None) for k in OPTION_ATTR_ALL)
self.includes = []
self.predicates = []
- self.read_only = False
self.alternate = True # add --no- alternative long option for bool
self.filename = None
for (attr, val) in d.items():
assert attr in self.__dict__
- if attr in ['read_only', 'alternate'] or val:
+ if attr == 'alternate' or val:
self.__dict__[attr] = val
@@ -274,6 +264,7 @@ def die(msg):
def perr(filename, msg, option = None):
+ msg_suffix = ''
if option:
if option.name:
msg_suffix = "option '{}' ".format(option.name)
@@ -461,7 +452,7 @@ def codegen_module(module, dst_dir, tpl_module_h, tpl_module_cpp):
holder_specs.append(TPL_HOLDER_MACRO_ATTR.format(name=option.name))
# Generate module declaration
- tpl_decl = TPL_OPTION_STRUCT_RO if option.read_only else TPL_OPTION_STRUCT_RW
+ tpl_decl = TPL_OPTION_STRUCT_RW
if option.long:
long_name = option.long.split('=')[0]
else:
@@ -469,8 +460,7 @@ def codegen_module(module, dst_dir, tpl_module_h, tpl_module_cpp):
decls.append(tpl_decl.format(name=option.name, type=option.type, long_name = long_name))
# Generate module specialization
- if not option.read_only:
- specs.append(TPL_DECL_SET.format(name=option.name))
+ specs.append(TPL_DECL_SET.format(name=option.name))
specs.append(TPL_DECL_OP_BRACKET.format(name=option.name))
specs.append(TPL_DECL_WAS_SET_BY_USER.format(name=option.name))
@@ -492,8 +482,7 @@ def codegen_module(module, dst_dir, tpl_module_h, tpl_module_cpp):
### Generate code for {module.name}_options.cpp
# Accessors
- if not option.read_only:
- accs.append(TPL_IMPL_SET.format(name=option.name))
+ accs.append(TPL_IMPL_SET.format(name=option.name))
accs.append(TPL_IMPL_OP_BRACKET.format(name=option.name))
accs.append(TPL_IMPL_WAS_SET_BY_USER.format(name=option.name))
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback