From 4df8f0223b68e622035ada6e1a7dfb94bcd077dd Mon Sep 17 00:00:00 2001 From: Kyle Ambroff-Kao Date: Fri, 3 Jan 2020 15:29:12 -0800 Subject: [PATCH] tests: Fix build on x86_gcc2 This patch fixes the build of unittests on x86_gcc2. src/tests/kits/shared/KeymapTest.cpp: * Don't use auto * Don't use braced-initialization for std::map. src/tests/system/kernel/vm/Jamfile: * Link lock.o from kernel source to include _mutex_lock and _mutex_unlock when linking libkernelvmtest.so Change-Id: I60e02bfb23334064ec25d767f659a188e393ed1c Reviewed-on: https://review.haiku-os.org/c/haiku/+/2074 Reviewed-by: Adrien Destugues --- src/tests/kits/shared/KeymapTest.cpp | 29 ++++++++++++++-------------- src/tests/system/kernel/vm/Jamfile | 3 +++ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/tests/kits/shared/KeymapTest.cpp b/src/tests/kits/shared/KeymapTest.cpp index 7e2fe6f0be..fe1a21ea8c 100644 --- a/src/tests/kits/shared/KeymapTest.cpp +++ b/src/tests/kits/shared/KeymapTest.cpp @@ -70,22 +70,23 @@ KeymapTest::TestGetChars() CPPUNIT_ASSERT(keymap != NULL); // Test each of the keymap's character tables - std::map tables = { - {0, &keymap->normal_map}, - {B_SHIFT_KEY, &keymap->shift_map}, - {B_CAPS_LOCK, &keymap->caps_map}, - {B_CAPS_LOCK | B_SHIFT_KEY, &keymap->caps_shift_map}, - {B_CONTROL_KEY, &keymap->control_map}, - {B_OPTION_KEY, &keymap->option_map}, - {B_OPTION_KEY | B_SHIFT_KEY, &keymap->option_shift_map}, - {B_OPTION_KEY | B_CAPS_LOCK, &keymap->option_caps_map}, - {B_OPTION_KEY | B_SHIFT_KEY | B_CAPS_LOCK, - &keymap->option_caps_shift_map} - }; + typedef std::map table_map_t; + table_map_t tables; + tables[0] = &keymap->normal_map; + tables[B_SHIFT_KEY] = &keymap->shift_map; + tables[B_CAPS_LOCK] = &keymap->caps_map; + tables[B_CAPS_LOCK | B_SHIFT_KEY] = &keymap->caps_shift_map; + tables[B_CONTROL_KEY] = &keymap->control_map; + tables[B_OPTION_KEY] = &keymap->option_map; + tables[B_OPTION_KEY | B_SHIFT_KEY] = &keymap->option_shift_map; + tables[B_OPTION_KEY | B_CAPS_LOCK] = &keymap->option_caps_map; + tables[B_OPTION_KEY | B_SHIFT_KEY | B_CAPS_LOCK] = + &keymap->option_caps_shift_map; - for (auto p = tables.begin(); p != tables.end(); p++) { + for (table_map_t::const_iterator p = tables.begin(); + p != tables.end(); p++) { const uint32 modifiers = (*p).first; - const int (*table)[128] = (*p).second; + const int32(*table)[128] = (*p).second; // Test, for every keycode, that the result from BKeymap::GetChars() // matches what we find in our our own copy of the keymap diff --git a/src/tests/system/kernel/vm/Jamfile b/src/tests/system/kernel/vm/Jamfile index 57b2805ffb..392798eb75 100644 --- a/src/tests/system/kernel/vm/Jamfile +++ b/src/tests/system/kernel/vm/Jamfile @@ -15,6 +15,9 @@ UnitTestLib libkernelvmtest.so # fs KPath.cpp + + # locks + lock.cpp : [ TargetLibstdc++ ] ;