c_wrapper_generator: Refactored _write_epilogue()

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
This commit is contained in:
Minos Galanakis
2024-06-21 12:07:04 +01:00
parent 2ce5c0442f
commit 483507a28b
2 changed files with 12 additions and 12 deletions
@@ -94,18 +94,18 @@ class Base:
def _write_epilogue(self, out: typing_util.Writable, header: bool) -> None:
"""Write the epilogue of a C file.
"""
epilogue = []
if header:
out.write("""
#ifdef __cplusplus
}}
#endif
#endif /* {guard} */
"""
.format(guard=self.header_guard))
out.write("""
/* End of automatically generated file. */
""")
epilogue += ['',
'#ifdef __cplusplus',
'}',
'#endif',
'',
'#endif /* {} */'.format(self.header_guard),
'']
epilogue.append('/* End of automatically generated file. */')
epilogue.append('')
out.write("\n".join(epilogue))
def _wrapper_function_name(self, original_name: str) -> str:
"""The name of the wrapper function.
@@ -205,7 +205,7 @@ class PSAWrapper(c_wrapper_generator.Base):
def _write_epilogue(self, out: typing_util.Writable, header: bool) -> None:
if self._CPP_GUARDS:
out.write(dedent(self.__EPILOGUE__).format(self._CPP_GUARDS))
out.write("\n#endif /* {} */\n".format(self._CPP_GUARDS))
super()._write_epilogue(out, header)
class PSALoggingWrapper(PSAWrapper, c_wrapper_generator.Logging):