Skip to content

Commit a14407a

Browse files
committed
Added test on binutil souce code version (compare with main lib).
1 parent 556c072 commit a14407a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/codegen/c-util-generator.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,6 @@ void CiUtilGenerator::PrintHeader()
112112
// include c-main driver header
113113
tof->AppendLine(StrPrint("#include \"%s.h\"", file_drvname.c_str()), 2);
114114

115-
// put version info macros
116-
tof->AppendLine("// This version definition comes from main driver version and");
117-
tof->AppendLine("// can be compared in user code space for strict compatibility test");
118-
tof->AppendLine(StrPrint("#define %s (%uU)", fdesc->verhigh_def.c_str(), p_dlist->ver.hi));
119-
tof->AppendLine(StrPrint("#define %s (%uU)", fdesc->verlow_def.c_str(), p_dlist->ver.low), 2);
120115

121116
if (rx.size() == 0)
122117
{
@@ -191,6 +186,14 @@ void CiUtilGenerator::PrintSource()
191186

192187
tof->AppendLine(StrPrint("#include \"%s\"", fdesc->util_h.fname.c_str()), 2);
193188

189+
tof->AppendLine("// DBC file version");
190+
tof->AppendLine(StrPrint("#if (%s != (%uU)) || (%s != (%uU))",
191+
fdesc->verhigh_def.c_str(), p_dlist->ver.hi, fdesc->verlow_def.c_str(), p_dlist->ver.low));
192+
193+
tof->AppendLine(StrPrint("#error The %s binutil source file has inconsistency with core dbc lib!",
194+
fdesc->DRVNAME.c_str()));
195+
tof->AppendLine("#endif", 2);
196+
194197
// optional RX and TX struct allocations
195198
if (rx.size() > 0 || tx.size() > 0)
196199
{

0 commit comments

Comments
 (0)