diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-06-27 07:27:21 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2015-09-04 15:47:13 +0200 |
commit | 00dfc3b2c272d98556ec6095d56bdd8b036babf9 (patch) | |
tree | 1f7a59dc2e19613e673169540b49bd53091ca837 /scripts | |
parent | 77e703b861d34bb2879f3e845482d5cf0a3a0ad1 (diff) | |
download | hqemu-00dfc3b2c272d98556ec6095d56bdd8b036babf9.zip hqemu-00dfc3b2c272d98556ec6095d56bdd8b036babf9.tar.gz |
qapi: Simplify guardname()
The guards around built-in declarations lose their _H. It never made
much sense anyway.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/qapi.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py index e656beb..ba11c54 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -958,14 +958,9 @@ def mcgen(code, **kwds): code = code[1:] return cgen(code, **kwds) -def basename(filename): - return filename.split("/")[-1] def guardname(filename): - guard = basename(filename).rsplit(".", 1)[0] - for substr in [".", " ", "-"]: - guard = guard.replace(substr, "_") - return guard.upper() + '_H' + return c_name(filename, protect=False).upper() def guardstart(name): return mcgen(''' @@ -1035,6 +1030,7 @@ def parse_command_line(extra_options = "", extra_long_options = []): def open_output(output_dir, do_c, do_h, prefix, c_file, h_file, c_comment, h_comment): + guard = guardname(prefix + h_file) c_file = output_dir + prefix + c_file h_file = output_dir + prefix + h_file @@ -1067,7 +1063,7 @@ def open_output(output_dir, do_c, do_h, prefix, c_file, h_file, #define %(guard)s ''', - comment = h_comment, guard = guardname(h_file))) + comment = h_comment, guard = guard)) return (fdef, fdecl) |