summaryrefslogtreecommitdiff
path: root/src/options/mkoptions.py
diff options
context:
space:
mode:
authorGereon Kremer <nafur42@gmail.com>2021-08-03 14:44:35 -0700
committerGitHub <noreply@github.com>2021-08-03 14:44:35 -0700
commit1cb1934d76f25e9f42f51b2eead733b3e9e12236 (patch)
tree1a8aa189baa114a9af340e15fb138186664833d6 /src/options/mkoptions.py
parent2c2981d419bdf5a7bbf424f62266883724e85168 (diff)
Use int64_t, uint64_t or double for all numeric options. (#6970)
This PR further simplifies the option setup by only using int64_t or uint64_t for integer options.
Diffstat (limited to 'src/options/mkoptions.py')
-rw-r--r--src/options/mkoptions.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/options/mkoptions.py b/src/options/mkoptions.py
index aeff832b5..04b02e23e 100644
--- a/src/options/mkoptions.py
+++ b/src/options/mkoptions.py
@@ -61,7 +61,6 @@ OPTION_ATTR_ALL = OPTION_ATTR_REQ + [
]
CATEGORY_VALUES = ['common', 'expert', 'regular', 'undocumented']
-SUPPORTED_CTYPES = ['int', 'unsigned', 'unsigned long', 'double']
### Other globals
@@ -249,12 +248,16 @@ def get_getall(module, option):
if option.type == 'bool':
return 'res.push_back({{"{}", opts.{}.{} ? "true" : "false"}});'.format(
option.long_name, module.id, option.name)
+ elif option.type == 'std::string':
+ return 'res.push_back({{"{}", opts.{}.{}}});'.format(
+ option.long_name, module.id, option.name)
elif is_numeric_cpp_type(option.type):
return 'res.push_back({{"{}", std::to_string(opts.{}.{})}});'.format(
option.long_name, module.id, option.name)
else:
- return '{{ std::stringstream ss; ss << opts.{}.{}; res.push_back({{"{}", ss.str()}}); }}'.format(
- module.id, option.name, option.long_name)
+ return '{{ std::stringstream ss; ss << opts.{}.{}; res.push_back({{"{}", ss.str()}}); }}'.format(module.id,
+ option.name, option.long_name)
+
class Module(object):
"""Options module.
@@ -459,11 +462,7 @@ def is_numeric_cpp_type(ctype):
Check if given type is a numeric C++ type (this should cover the most
common cases).
"""
- if ctype in SUPPORTED_CTYPES:
- return True
- elif re.match('u?int[0-9]+_t', ctype):
- return True
- return False
+ return ctype in ['int64_t', 'uint64_t', 'double']
def format_include(include):
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback