Make vboot_reference build in MSVC command line environment.
This is a mostly NOOP change which modifies the source code
to compile cleanly in the MSVC command line build
environment.
A new makefile is introduced (msc/nmakefile) along with a
README.txt in the same directory explaining how to build
the code in the DOS window. As of this submission the build
is running in a 32 bit environment, the intention is to use
the same makefile for 64 bit builds in the future.
Enabling high compilation warnings level allowed to
identify a couple of bugs in the code which are being fixed.
Not all sources are being compiled in the MSVC environment,
only those in firmware/ and most of those in test/
subdirectories. The benchmark calculations require porting
of the timer facilities and are being postponed.
TEST
Built in DOS and linux environments. Ran unit tests in
linux environment.
Review URL: http://codereview.chromium.org/2809037
diff --git a/tests/vboot_common_tests.c b/tests/vboot_common_tests.c
index e707daf..d01b2f9 100644
--- a/tests/vboot_common_tests.c
+++ b/tests/vboot_common_tests.c
@@ -31,24 +31,24 @@
{
uint8_t p[1];
- TEST_EQ(OffsetOf(p, p), 0, "OffsetOf() equal");
- TEST_EQ(OffsetOf(p, p+10), 10, "OffsetOf() positive");
- TEST_EQ(OffsetOf(p, p+0x12345678), 0x12345678, "OffsetOf() large");
+ TEST_EQ((int)OffsetOf(p, p), 0, "OffsetOf() equal");
+ TEST_EQ((int)OffsetOf(p, p+10), 10, "OffsetOf() positive");
+ TEST_EQ((int)OffsetOf(p, p+0x12345678), 0x12345678, "OffsetOf() large");
}
{
VbPublicKey k = {sizeof(k), 2, 3, 4};
- TEST_EQ(OffsetOf(&k, GetPublicKeyData(&k)), sizeof(k),
+ TEST_EQ((int)OffsetOf(&k, GetPublicKeyData(&k)), sizeof(k),
"GetPublicKeyData() adjacent");
- TEST_EQ(OffsetOf(&k, GetPublicKeyDataC(&k)), sizeof(k),
+ TEST_EQ((int)OffsetOf(&k, GetPublicKeyDataC(&k)), sizeof(k),
"GetPublicKeyDataC() adjacent");
}
{
VbPublicKey k = {123, 2, 3, 4};
- TEST_EQ(OffsetOf(&k, GetPublicKeyData(&k)), 123,
+ TEST_EQ((int)OffsetOf(&k, GetPublicKeyData(&k)), 123,
"GetPublicKeyData() spaced");
- TEST_EQ(OffsetOf(&k, GetPublicKeyDataC(&k)), 123,
+ TEST_EQ((int)OffsetOf(&k, GetPublicKeyDataC(&k)), 123,
"GetPublicKeyDataC() spaced");
}
@@ -64,7 +64,7 @@
"MemberInside member too big");
TEST_EQ(VerifyMemberInside(p, 20, p, 4, 21, 0), 1,
"MemberInside data after parent");
- TEST_EQ(VerifyMemberInside(p, 20, p, 4, -1, 0), 1,
+ TEST_EQ(VerifyMemberInside(p, 20, p, 4, (uint64_t)-1, 0), 1,
"MemberInside data before parent");
TEST_EQ(VerifyMemberInside(p, 20, p, 4, 4, 17), 1,
"MemberInside data too big");
@@ -101,6 +101,8 @@
}
+/* disable MSVC warnings on unused arguments */
+__pragma(warning (disable: 4100))
int main(int argc, char* argv[]) {
int error_code = 0;