Add message at top of codegen files to avoid overwriting them

This commit is contained in:
2025-03-02 13:42:23 +00:00
parent 96db885344
commit 70e075d2f6
3 changed files with 34 additions and 3 deletions

View File

@@ -202,7 +202,12 @@ class CFile:
outfile.write(str(self))
def __str__(self) -> str:
return ""
return """\
/**
* THIS FILE IS AUTOMATICALLY GENERATED. ANY MODIFICATIONS TO IT WILL BE OVERWRITTEN
*/
"""
@dataclass
@@ -237,7 +242,17 @@ class CHeader(CFile):
for func in self.funcs:
funcs += func.declare()
return header_guard_open + includes + c_linkage_open + forward_declarations + types + funcs + c_linkage_close + header_guard_close
return (
super().__str__() +
header_guard_open +
includes +
c_linkage_open +
forward_declarations +
types +
funcs +
c_linkage_close +
header_guard_close
)
@dataclass
@@ -274,7 +289,15 @@ class CSource(CFile):
for func in self.funcs:
funcs += func.define()
return includes + forward_declarations + types + internal_funcs_decl + funcs + internal_funcs_def
return (
super().__str__() +
includes +
forward_declarations +
types +
internal_funcs_decl +
funcs +
internal_funcs_def
)
def get_datatype_string(_type: CDataType) -> str: