summaryrefslogtreecommitdiff
path: root/xsd/xsd/cxx/tree
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-12-01 15:40:58 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-12-01 15:40:58 +0200
commit05ceabed32d6e0a67578b3679fbc69381a0fdffc (patch)
tree2abb4a66587137e1577bd58cff6e02818443a2e6 /xsd/xsd/cxx/tree
parentfd9f51181d71cd0219ab5e30289368c44cfb48e9 (diff)
Move inline file inclusion after header file epilogue
This makes a difference if the epilogue defines something (e.g., a custom type) that must be defined (rather than just declared) in the inline file.
Diffstat (limited to 'xsd/xsd/cxx/tree')
-rw-r--r--xsd/xsd/cxx/tree/generator.cxx27
1 files changed, 19 insertions, 8 deletions
diff --git a/xsd/xsd/cxx/tree/generator.cxx b/xsd/xsd/cxx/tree/generator.cxx
index 5601f4e..3233248 100644
--- a/xsd/xsd/cxx/tree/generator.cxx
+++ b/xsd/xsd/cxx/tree/generator.cxx
@@ -928,19 +928,16 @@ namespace CXX
}
}
- if (inline_)
- {
- hxx << "#ifndef XSD_DONT_INCLUDE_INLINE" << endl
- << "#include " << ctx.process_include_path (ixx_name) << endl
- << "#endif // XSD_DONT_INCLUDE_INLINE" << endl
- << endl;
- }
-
hxx << "#include <xsd/cxx/post.hxx>" << endl
<< endl;
// Copy epilogue.
//
+ // Note that it goes before the inline file in case it defines
+ // something (such as a custom type) which is needed by this file.
+ // And if something in the epilogue needs something from the inline
+ // file, then it should be the inline rather than header epilogue.
+ //
hxx << "// Begin epilogue." << endl
<< "//" << endl;
@@ -951,6 +948,14 @@ namespace CXX
<< "// End epilogue." << endl
<< endl;
+ if (inline_)
+ {
+ hxx << "#ifndef XSD_DONT_INCLUDE_INLINE" << endl
+ << "#include " << ctx.process_include_path (ixx_name) << endl
+ << "#endif // XSD_DONT_INCLUDE_INLINE" << endl
+ << endl;
+ }
+
hxx << "#endif // " << guard << endl;
if (show_sloc)
@@ -999,6 +1004,9 @@ namespace CXX
<< "// End prologue." << endl
<< endl;
+ ixx << "#include <xsd/cxx/pre.hxx>" << endl
+ << endl;
+
// Generate.
//
{
@@ -1006,6 +1014,9 @@ namespace CXX
generate_tree_inline (ctx, 1, 0);
}
+ ixx << "#include <xsd/cxx/post.hxx>" << endl
+ << endl;
+
// Copy epilogue.
//
ixx << "// Begin epilogue." << endl