Skip to content

Commit

Permalink
idl-compiler: emit include directive in generated impl header file
Browse files Browse the repository at this point in the history
The generated implementation header file depends
on the generated header file for the types it uses.
Generate a respective #include directive to make it self-sufficient.

Signed-off-by: Benny Halevy <[email protected]>
  • Loading branch information
bhalevy committed May 2, 2024
1 parent e1411f3 commit 7f7e461
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions idl-compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1699,21 +1699,21 @@ def setup_additional_metadata(tree, ns_context = [], parent_template_params=[]):


def load_file(name):
if config.o:
cout = open(config.o.replace('.hh', '.impl.hh'), "w+")
hout = open(config.o, "w+")
else:
cout = open(name.replace(EXTENSION, '.dist.impl.hh'), "w+")
hout = open(name.replace(EXTENSION, '.dist.hh'), "w+")
cname = config.o.replace('.hh', '.impl.hh') if config.o else name.replace(EXTENSION, '.dist.impl.hh')
hname = config.o or name.replace(EXTENSION, '.dist.hh')
cout = open(cname, "w+")
hout = open(hname, "w+")
print_cw(hout)
fprintln(hout, """
/*
* The generate code should be included in a header file after
* The object definition
*/
""")
print_cw(cout)
fprintln(hout, "#include \"serializer.hh\"\n")

print_cw(cout)
fprintln(cout, f"#include \"{os.path.basename(hname)}\"")
fprintln(cout, "#include \"serializer_impl.hh\"")
fprintln(cout, "#include \"serialization_visitors.hh\"")

Expand Down

0 comments on commit 7f7e461

Please sign in to comment.