Upgrade codebase to C++ 20 + fix warnings + update submodules (#6115)

This commit is contained in:
GPUCode 2022-09-21 19:36:12 +03:00 committed by GitHub
parent 90b418fd1a
commit cbd5d1c15c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
67 changed files with 6837 additions and 7475 deletions

View file

@ -11,7 +11,6 @@ add_executable(tests
core/memory/vm_manager.cpp
audio_core/audio_fixures.h
audio_core/decoder_tests.cpp
tests.cpp
)
if (ARCHITECTURE_x86_64)
@ -24,6 +23,6 @@ endif()
create_target_directory_groups(tests)
target_link_libraries(tests PRIVATE common core video_core audio_core)
target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} catch-single-include nihstro-headers Threads::Threads)
target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} Catch2::Catch2WithMain nihstro-headers Threads::Threads)
add_test(NAME tests COMMAND tests)

View file

@ -3,7 +3,7 @@
// Refer to the license.txt file included.
#if defined(HAVE_MF) || defined(HAVE_FFMPEG)
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hle/kernel/memory.h"

View file

@ -5,7 +5,7 @@
#include <array>
#include <cstring>
#include <type_traits>
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "common/bit_field.h"
TEST_CASE("BitField", "[common]") {

View file

@ -3,7 +3,7 @@
// Refer to the license.txt file included.
#include <cmath>
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "common/param_package.h"
namespace Common {

View file

@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "core/arm/dyncom/arm_dyncom.h"
#include "core/core.h"
#include "core/core_timing.h"

View file

@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <array>
#include <bitset>

View file

@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "common/file_util.h"
#include "core/file_sys/path_parser.h"

View file

@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "common/archives.h"
#include "core/core.h"
#include "core/core_timing.h"

View file

@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hle/kernel/memory.h"

View file

@ -3,7 +3,7 @@
// Refer to the license.txt file included.
#include <vector>
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "core/hle/kernel/errors.h"
#include "core/hle/kernel/memory.h"
#include "core/hle/kernel/vm_manager.h"

View file

@ -1,9 +0,0 @@
// Copyright 2016 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
// Catch provides the main function since we've given it the
// CATCH_CONFIG_MAIN preprocessor directive.

View file

@ -5,7 +5,8 @@
#include <algorithm>
#include <cmath>
#include <memory>
#include <catch2/catch.hpp>
#include <catch2/catch_approx.hpp>
#include <catch2/catch_test_macros.hpp>
#include <nihstro/inline_assembly.h>
#include "video_core/shader/shader_interpreter.h"
#include "video_core/shader/shader_jit_x64_compiler.h"
@ -78,9 +79,9 @@ TEST_CASE("LG2", "[video_core][shader][shader_jit]") {
REQUIRE(std::isnan(shader.Run(NAN)));
REQUIRE(std::isnan(shader.Run(-1.f)));
REQUIRE(std::isinf(shader.Run(0.f)));
REQUIRE(shader.Run(4.f) == Approx(2.f));
REQUIRE(shader.Run(64.f) == Approx(6.f));
REQUIRE(shader.Run(1.e24f) == Approx(79.7262742773f));
REQUIRE(shader.Run(4.f) == Catch::Approx(2.f));
REQUIRE(shader.Run(64.f) == Catch::Approx(6.f));
REQUIRE(shader.Run(1.e24f) == Catch::Approx(79.7262742773f));
}
TEST_CASE("EX2", "[video_core][shader][shader_jit]") {
@ -95,11 +96,11 @@ TEST_CASE("EX2", "[video_core][shader][shader_jit]") {
});
REQUIRE(std::isnan(shader.Run(NAN)));
REQUIRE(shader.Run(-800.f) == Approx(0.f));
REQUIRE(shader.Run(0.f) == Approx(1.f));
REQUIRE(shader.Run(2.f) == Approx(4.f));
REQUIRE(shader.Run(6.f) == Approx(64.f));
REQUIRE(shader.Run(79.7262742773f) == Approx(1.e24f));
REQUIRE(shader.Run(-800.f) == Catch::Approx(0.f));
REQUIRE(shader.Run(0.f) == Catch::Approx(1.f));
REQUIRE(shader.Run(2.f) == Catch::Approx(4.f));
REQUIRE(shader.Run(6.f) == Catch::Approx(64.f));
REQUIRE(shader.Run(79.7262742773f) == Catch::Approx(1.e24f));
REQUIRE(std::isinf(shader.Run(800.f)));
}
@ -137,7 +138,7 @@ TEST_CASE("Nested Loop", "[video_core][shader][shader_jit]") {
shader_test.RunJit(shader_unit_jit, input);
REQUIRE(shader_unit_jit.address_registers[2] == expected_aL);
REQUIRE(shader_unit_jit.registers.output[0].x.ToFloat32() == Approx(expected_out));
REQUIRE(shader_unit_jit.registers.output[0].x.ToFloat32() == Catch::Approx(expected_out));
}
{
shader_test.shader_setup->uniforms.i[0] = {9, 0, 2, 0};
@ -154,6 +155,6 @@ TEST_CASE("Nested Loop", "[video_core][shader][shader_jit]") {
shader_test.RunJit(shader_unit_jit, input);
REQUIRE(shader_unit_jit.address_registers[2] == expected_aL);
REQUIRE(shader_unit_jit.registers.output[0].x.ToFloat32() == Approx(expected_out));
REQUIRE(shader_unit_jit.registers.output[0].x.ToFloat32() == Catch::Approx(expected_out));
}
}