mirror of https://github.com/rusefi/rusefi.git
This commit is contained in:
parent
5ddbcf56e8
commit
08620bedea
Binary file not shown.
|
@ -80,7 +80,10 @@ public class BaseCHeaderConsumer implements ConfigurationConsumer {
|
||||||
}
|
}
|
||||||
|
|
||||||
content.append("};" + EOL);
|
content.append("};" + EOL);
|
||||||
content.append("static_assert(sizeof(" + structure.getName() + ") == " + iterator.currentOffset + ");\n");
|
int realSize = iterator.currentOffset;
|
||||||
|
// https://stackoverflow.com/questions/621616/c-what-is-the-size-of-an-object-of-an-empty-class
|
||||||
|
int cppSize = Math.max(1, realSize);
|
||||||
|
content.append("static_assert(sizeof(" + structure.getName() + ") == " + cppSize + ");\n");
|
||||||
content.append(EOL);
|
content.append(EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class TSProjectConsumerTest {
|
||||||
assertEquals("// start of pid_s\n" +
|
assertEquals("// start of pid_s\n" +
|
||||||
"struct pid_s {\n" +
|
"struct pid_s {\n" +
|
||||||
"};\n" +
|
"};\n" +
|
||||||
"static_assert(sizeof(pid_s) == 0);\n" +
|
"static_assert(sizeof(pid_s) == 1);\n" +
|
||||||
"\n", consumer.getContent());
|
"\n", consumer.getContent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue