diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/make_device_config.sh | 2 | ||||
-rw-r--r-- | scripts/qapi-types.py | 11 | ||||
-rw-r--r-- | scripts/tracetool/format/d.py | 26 |
3 files changed, 27 insertions, 12 deletions
diff --git a/scripts/make_device_config.sh b/scripts/make_device_config.sh index 7242707819..7958086132 100644 --- a/scripts/make_device_config.sh +++ b/scripts/make_device_config.sh @@ -2,7 +2,7 @@ # Construct a target device config file from a default, pulling in any # files from include directives. -dest=$1.tmp +dest=$1 dep=`dirname $1`-`basename $1`.d src=$2 src_dir=`dirname $src` diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index 1eb272dd26..db872180c6 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -123,16 +123,19 @@ const char *%(name)s_lookup[] = { name=name) i = 0 for value in values: + index = generate_enum_full_value(name, value) ret += mcgen(''' - "%(value)s", + [%(index)s] = "%(value)s", ''', - value=value) + index = index, value = value) + max_index = generate_enum_full_value(name, 'MAX') ret += mcgen(''' - NULL, + [%(max_index)s] = NULL, }; -''') +''', + max_index=max_index) return ret def generate_enum(name, values): diff --git a/scripts/tracetool/format/d.py b/scripts/tracetool/format/d.py index 46eebb128b..c77d5b7ab0 100644 --- a/scripts/tracetool/format/d.py +++ b/scripts/tracetool/format/d.py @@ -16,6 +16,19 @@ __email__ = "stefanha@linux.vnet.ibm.com" from tracetool import out +# Reserved keywords from +# https://wikis.oracle.com/display/DTrace/Types,+Operators+and+Expressions +RESERVED_WORDS = ( + 'auto', 'goto', 'sizeof', 'break', 'if', 'static', 'case', 'import', + 'string', 'char', 'inline', 'stringof', 'const', 'int', 'struct', + 'continue', 'long', 'switch', 'counter', 'offsetof', 'this', + 'default', 'probe', 'translator', 'do', 'provider', 'typedef', + 'double', 'register', 'union', 'else', 'restrict', 'unsigned', + 'enum', 'return', 'void', 'extern', 'self', 'volatile', 'float', + 'short', 'while', 'for', 'signed', 'xlate', +) + + def generate(events, backend): events = [e for e in events if "disable" not in e.properties] @@ -25,18 +38,17 @@ def generate(events, backend): 'provider qemu {') for e in events: - args = str(e.args) - - # DTrace provider syntax expects foo() for empty - # params, not foo(void) - if args == 'void': - args = '' + args = [] + for type_, name in e.args: + if name in RESERVED_WORDS: + name += '_' + args.append(type_ + ' ' + name) # Define prototype for probe arguments out('', 'probe %(name)s(%(args)s);', name=e.name, - args=args) + args=','.join(args)) out('', '};') |