VERY experimental Nintendo Switch 2 emulator
C++
Common: Cleanup memory and misc includes.
Emmanuel Gil Peyrot2d044a67c932
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.hindex 91b74c6bcd..cc74a228ea 100644--- a/src/common/common_funcs.h+++ b/src/common/common_funcs.h@@ -5,8 +5,6 @@#pragma once#include "common_types.h"-#include <cstdlib>-#define b2(x) ( (x) | ( (x) >> 1) )#define b4(x) ( b2(x) | ( b2(x) >> 2) )@@ -43,8 +41,6 @@#ifndef _MSC_VER-#include <errno.h>-#if defined(__x86_64__) || defined(_M_X64)#define Crash() __asm__ __volatile__("int $3")#elif defined(_M_ARM)diff --git a/src/common/common_types.h b/src/common/common_types.hindex f6de0adfc1..ebfd7824a3 100644--- a/src/common/common_types.h+++ b/src/common/common_types.h@@ -24,9 +24,7 @@#pragma once-#include <cmath>#include <cstdint>-#include <cstdlib>#ifdef _MSC_VER#ifndef __func__diff --git a/src/common/logging/log.h b/src/common/logging/log.hindex 5b3a731e9b..e16dde7fce 100644--- a/src/common/logging/log.h+++ b/src/common/logging/log.h@@ -4,10 +4,6 @@#pragma once-#include <cassert>-#include <chrono>-#include <string>-#include "common/common_types.h"namespace Log {diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cppindex 20b791a101..2b3ace5288 100644--- a/src/common/memory_util.cpp+++ b/src/common/memory_util.cpp@@ -3,14 +3,17 @@// Refer to the license.txt file included.-#include "common/common_funcs.h"#include "common/logging/log.h"#include "common/memory_util.h"-#include "common/string_util.h"#ifdef _WIN32-#include <windows.h>-#include <psapi.h>+ #include <windows.h>+ #include <psapi.h>+ #include "common/common_funcs.h"+ #include "common/string_util.h"+#else+ #include <cstdlib>+ #include <sys/mman.h>#endif#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT)diff --git a/src/common/memory_util.h b/src/common/memory_util.hindex 9fdbf1f121..9bf37c44fd 100644--- a/src/common/memory_util.h+++ b/src/common/memory_util.h@@ -4,9 +4,7 @@#pragma once-#ifndef _WIN32-#include <sys/mman.h>-#endif+#include <cstddef>#include <string>void* AllocateExecutableMemory(size_t size, bool low = true);diff --git a/src/common/misc.cpp b/src/common/misc.cppindex 53cacf37cf..d2a049b636 100644--- a/src/common/misc.cpp+++ b/src/common/misc.cpp@@ -2,12 +2,13 @@// Licensed under GPLv2 or any later version// Refer to the license.txt file included.-#include "common/common_funcs.h"+#include <cstddef>#ifdef _WIN32#include <windows.h>#else-#include <string.h>+#include <cerrno>+#include <cstring>#endif// Neither Android nor OS X support TLSdiff --git a/src/common/swap.h b/src/common/swap.hindex 588cebc708..b92e5bfa49 100644--- a/src/common/swap.h+++ b/src/common/swap.h@@ -17,12 +17,16 @@#pragma once-#if defined(__linux__)-#include <byteswap.h>+#if defined(_MSC_VER)+ #include <cstdlib>+#elif defined(__linux__)+ #include <byteswap.h>#elif defined(__FreeBSD__)-#include <sys/endian.h>+ #include <sys/endian.h>#endif+#include "common/common_types.h"+// GCC 4.6+#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)diff --git a/src/core/file_sys/file_backend.h b/src/core/file_sys/file_backend.hindex 0fcff18454..f5f72c722d 100644--- a/src/core/file_sys/file_backend.h+++ b/src/core/file_sys/file_backend.h@@ -4,6 +4,8 @@#pragma once+#include <cstddef>+#include "common/common_types.h"////////////////////////////////////////////////////////////////////////////////////////////////////diff --git a/src/core/memory.cpp b/src/core/memory.cppindex 28844a9154..172ae90546 100644--- a/src/core/memory.cpp+++ b/src/core/memory.cpp@@ -9,9 +9,6 @@#include "common/logging/log.h"#include "common/swap.h"-#include "core/hle/config_mem.h"-#include "core/hle/shared_page.h"-#include "core/hw/hw.h"#include "core/mem_map.h"#include "core/memory.h"#include "core/memory_setup.h"diff --git a/src/core/memory.h b/src/core/memory.hindex 0b8ff9ec4e..418609de07 100644--- a/src/core/memory.h+++ b/src/core/memory.h@@ -4,6 +4,8 @@#pragma once+#include <cstddef>+#include "common/common_types.h"namespace Memory {