Add message at top of codegen files to avoid overwriting them

This commit is contained in:
Abdelrahman Said 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)) outfile.write(str(self))
def __str__(self) -> str: def __str__(self) -> str:
return "" return """\
/**
* THIS FILE IS AUTOMATICALLY GENERATED. ANY MODIFICATIONS TO IT WILL BE OVERWRITTEN
*/
"""
@dataclass @dataclass
@ -237,7 +242,17 @@ class CHeader(CFile):
for func in self.funcs: for func in self.funcs:
funcs += func.declare() 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 @dataclass
@ -274,7 +289,15 @@ class CSource(CFile):
for func in self.funcs: for func in self.funcs:
funcs += func.define() 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: def get_datatype_string(_type: CDataType) -> str:

View File

@ -1,3 +1,7 @@
/**
* THIS FILE IS AUTOMATICALLY GENERATED. ANY MODIFICATIONS TO IT WILL BE OVERWRITTEN
*/
#include "./str8_list.h" #include "./str8_list.h"
#include "../../../common/aliases/aliases.h" #include "../../../common/aliases/aliases.h"
#include "./str8.h" #include "./str8.h"

View File

@ -1,3 +1,7 @@
/**
* THIS FILE IS AUTOMATICALLY GENERATED. ANY MODIFICATIONS TO IT WILL BE OVERWRITTEN
*/
#ifndef STR8_LIST_H #ifndef STR8_LIST_H
#define STR8_LIST_H #define STR8_LIST_H