gdbus-codegen: Add support for pragma inclusion guard

The #pragma once is widely supported preprocessor directive that can
be used instead of include guards.

This adds support for using optionally this directive instead of
include guards.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
This commit is contained in:
Iñigo Martínez
2018-01-03 17:01:30 +01:00
parent e59bce3c74
commit c658d03b76
3 changed files with 32 additions and 8 deletions

View File

@@ -163,6 +163,8 @@ def codegen_main():
help='Generate autocleanup support')
arg_parser.add_argument('--generate-docbook', metavar='OUTFILES',
help='Generate Docbook in OUTFILES-org.Project.IFace.xml')
arg_parser.add_argument('--pragma-once', action='store_true',
help='Use "pragma once" as the inclusion guard')
arg_parser.add_argument('--annotate', nargs=3, action='append', metavar='WHAT KEY VALUE',
help='Add annotation (may be used several times)')
arg_parser.add_argument('--output-directory', metavar='OUTDIR', default='',
@@ -204,7 +206,8 @@ def codegen_main():
args.c_generate_autocleanup,
docbook_gen,
h, c,
header_name)
header_name,
args.pragma_once)
ret = gen.generate()
h.close()
c.close()