diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py index f89d748ba40825f609472d942d734523ea824caf..8e8da7c7962bf36fdc83973be38c9bd4a17ac89e 100644 --- a/scripts/qapi-commands.py +++ b/scripts/qapi-commands.py @@ -255,38 +255,18 @@ class QAPISchemaGenCommandVisitor(QAPISchemaVisitor): (input_file, output_dir, do_c, do_h, prefix, opts) = parse_command_line() -c_comment = ''' -/* - * schema-defined QMP->QAPI command dispatch +blurb = ''' + * Schema-defined QAPI/QMP commands * * Copyright IBM, Corp. 2011 * * Authors: * Anthony Liguori - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ -''' -h_comment = ''' -/* - * schema-defined QAPI function prototypes - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ ''' (fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix, 'qmp-marshal.c', 'qmp-commands.h', - c_comment, h_comment) + blurb) fdef.write(mcgen(''' diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py index c710968dc225c43dfaa00d35d3adec49ec65beee..2b7d720c08fe55709602189329473c2ccbd32891 100644 --- a/scripts/qapi-event.py +++ b/scripts/qapi-event.py @@ -171,38 +171,18 @@ class QAPISchemaGenEventVisitor(QAPISchemaVisitor): (input_file, output_dir, do_c, do_h, prefix, dummy) = parse_command_line() -c_comment = ''' -/* - * schema-defined QAPI event functions +blurb = ''' + * Schema-defined QAPI/QMP events * * Copyright (c) 2014 Wenchao Xia * * Authors: * Wenchao Xia - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ -''' -h_comment = ''' -/* - * schema-defined QAPI event functions - * - * Copyright (c) 2014 Wenchao Xia - * - * Authors: - * Wenchao Xia - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ ''' (fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix, 'qapi-event.c', 'qapi-event.h', - c_comment, h_comment) + blurb) fdef.write(mcgen(''' #include "qemu/osdep.h" diff --git a/scripts/qapi-introspect.py b/scripts/qapi-introspect.py index 032bcea4910ca392206a4e4b84981edbc641319e..83da2bdb942b7a9daa421f6859cd0ba8d33ecb44 100644 --- a/scripts/qapi-introspect.py +++ b/scripts/qapi-introspect.py @@ -176,32 +176,15 @@ for o, a in opts: if o in ('-u', '--unmask-non-abi-names'): opt_unmask = True -c_comment = ''' -/* +blurb = ''' * QAPI/QMP schema introspection * * Copyright (C) 2015 Red Hat, Inc. - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ -''' -h_comment = ''' -/* - * QAPI/QMP schema introspection - * - * Copyright (C) 2015 Red Hat, Inc. - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ ''' (fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix, 'qmp-introspect.c', 'qmp-introspect.h', - c_comment, h_comment) + blurb) fdef.write(mcgen(''' #include "qemu/osdep.h" diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index 7e3051dbb986c2cff8ca13f1a9de69a5e515cc2e..86afc57f92358d7872497949985695d42966e77c 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -250,39 +250,19 @@ for o, a in opts: if o in ('-b', '--builtins'): do_builtins = True -c_comment = ''' -/* - * deallocation functions for schema-defined QAPI types +blurb = ''' + * Schema-defined QAPI types * * Copyright IBM, Corp. 2011 * * Authors: * Anthony Liguori * Michael Roth - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ -''' -h_comment = ''' -/* - * schema-defined QAPI types - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ ''' (fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix, 'qapi-types.c', 'qapi-types.h', - c_comment, h_comment) + blurb) fdef.write(mcgen(''' #include "qemu/osdep.h" diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py index bc2b8b581a002ea93c4541c95deab6c76ca8587d..0a367072fbc6ebfb12c115f48e954557e3a9310c 100644 --- a/scripts/qapi-visit.py +++ b/scripts/qapi-visit.py @@ -334,38 +334,18 @@ for o, a in opts: if o in ('-b', '--builtins'): do_builtins = True -c_comment = ''' -/* - * schema-defined QAPI visitor functions +blurb = ''' + * Schema-defined QAPI visitors * * Copyright IBM, Corp. 2011 * * Authors: * Anthony Liguori - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ -''' -h_comment = ''' -/* - * schema-defined QAPI visitor functions - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ ''' (fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix, 'qapi-visit.c', 'qapi-visit.h', - c_comment, h_comment) + blurb) fdef.write(mcgen(''' #include "qemu/osdep.h" diff --git a/scripts/qapi.py b/scripts/qapi.py index 58f995b07fd23299d1becf10b3165b0070c7fed7..2e5a1ce6a8fe18e99c3c7c44fdb61afafd6178e5 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -1985,11 +1985,21 @@ 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): +def open_output(output_dir, do_c, do_h, prefix, c_file, h_file, blurb): guard = guardname(prefix + h_file) c_file = output_dir + prefix + c_file h_file = output_dir + prefix + h_file + comment = mcgen('''/* AUTOMATICALLY GENERATED, DO NOT MODIFY */ + +/* +%(blurb)s + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + */ + +''', + blurb=blurb.strip('\n')) if output_dir: try: @@ -2007,27 +2017,22 @@ def open_output(output_dir, do_c, do_h, prefix, c_file, h_file, fdef = maybe_open(do_c, c_file, 'w') fdecl = maybe_open(do_h, h_file, 'w') - fdef.write(mcgen(''' -/* AUTOMATICALLY GENERATED, DO NOT MODIFY */ -%(comment)s -''', - comment=c_comment)) - + fdef.write(comment) + fdecl.write(comment) fdecl.write(mcgen(''' -/* AUTOMATICALLY GENERATED, DO NOT MODIFY */ -%(comment)s #ifndef %(guard)s #define %(guard)s ''', - comment=h_comment, guard=guard)) + guard=guard)) return (fdef, fdecl) def close_output(fdef, fdecl): - fdecl.write(''' + fdecl.write(mcgen(''' + #endif -''') +''')) fdecl.close() fdef.close() diff --git a/scripts/qapi2texi.py b/scripts/qapi2texi.py index bf1c57b2e24f5f372b0dc30bc505262ad5347bbe..8a604d86a66e3006d81d3764dc32255e89c59c08 100755 --- a/scripts/qapi2texi.py +++ b/scripts/qapi2texi.py @@ -283,7 +283,8 @@ def main(argv): print("%s: need pragma 'doc-required' " "to generate documentation" % argv[0], file=sys.stderr) sys.exit(1) - print(texi_schema(schema)) + print('@c AUTOMATICALLY GENERATED, DO NOT MODIFY\n') + print(texi_schema(schema), end='') if __name__ == '__main__': diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.texi index 177831258157730490fe724d0919c2c94bcb6bb6..0aed2300a557499944c10aab217164ce62d993eb 100644 --- a/tests/qapi-schema/doc-good.texi +++ b/tests/qapi-schema/doc-good.texi @@ -1,3 +1,5 @@ +@c AUTOMATICALLY GENERATED, DO NOT MODIFY + @section Section @subsection Subsection @@ -231,4 +233,3 @@ If you're bored enough to read this, go see a video of boxed cats @end deftypefn -