yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

Merge pull request #1576 from smspillaz/fix-build-errors-03272016

Fix various build errors encountered on Clang 3.9 on OS X
This commit is contained in:
bunnei 2016-04-24 02:02:45 -04:00
commit 0964a3ff53
9 changed files with 29 additions and 9 deletions

View File

@ -65,8 +65,8 @@ endif()
message(STATUS "Target architecture: ${ARCHITECTURE}") message(STATUS "Target architecture: ${ARCHITECTURE}")
if (NOT MSVC) if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -Wno-attributes -pthread") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -Wno-attributes")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
if (ARCHITECTURE_x86_64) if (ARCHITECTURE_x86_64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
@ -135,6 +135,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/cmake-modules")
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR}) include_directories(${OPENGL_INCLUDE_DIR})
find_package(Threads REQUIRED)
if (ENABLE_SDL2) if (ENABLE_SDL2)
if (CITRA_USE_BUNDLED_SDL2) if (CITRA_USE_BUNDLED_SDL2)
# Detect toolchain and platform # Detect toolchain and platform

View File

@ -879,7 +879,7 @@ void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int nBaseY,
static int64_t nRefCpu = 0, nRefGpu = 0; static int64_t nRefCpu = 0, nRefGpu = 0;
if(MicroProfileGetGpuTickReference(&nTickReferenceCpu, &nTickReferenceGpu)) if(MicroProfileGetGpuTickReference(&nTickReferenceCpu, &nTickReferenceGpu))
{ {
if(0 == nRefCpu || abs(nRefCpu-nBaseTicksCpu) > abs(nTickReferenceCpu-nBaseTicksCpu)) if(0 == nRefCpu || std::abs(nRefCpu-nBaseTicksCpu) > std::abs(nTickReferenceCpu-nBaseTicksCpu))
{ {
nRefCpu = nTickReferenceCpu; nRefCpu = nTickReferenceCpu;
nRefGpu = nTickReferenceGpu; nRefGpu = nTickReferenceGpu;
@ -1230,7 +1230,12 @@ void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int nBaseY,
char ThreadName[MicroProfileThreadLog::THREAD_MAX_LEN + 16]; char ThreadName[MicroProfileThreadLog::THREAD_MAX_LEN + 16];
const char* cLocal = MicroProfileIsLocalThread(nThreadId) ? "*": " "; const char* cLocal = MicroProfileIsLocalThread(nThreadId) ? "*": " ";
#if defined(WIN32)
// nThreadId is 32-bit on Windows
int nStrLen = snprintf(ThreadName, sizeof(ThreadName)-1, "%04x: %s%s", nThreadId, cLocal, i < nNumThreadsBase ? &S.Pool[i]->ThreadName[0] : MICROPROFILE_THREAD_NAME_FROM_ID(nThreadId) ); int nStrLen = snprintf(ThreadName, sizeof(ThreadName)-1, "%04x: %s%s", nThreadId, cLocal, i < nNumThreadsBase ? &S.Pool[i]->ThreadName[0] : MICROPROFILE_THREAD_NAME_FROM_ID(nThreadId) );
#else
int nStrLen = snprintf(ThreadName, sizeof(ThreadName)-1, "%04llx: %s%s", nThreadId, cLocal, i < nNumThreadsBase ? &S.Pool[i]->ThreadName[0] : MICROPROFILE_THREAD_NAME_FROM_ID(nThreadId) );
#endif
uint32_t nThreadColor = -1; uint32_t nThreadColor = -1;
if(nThreadId == nContextSwitchHoverThreadAfter || nThreadId == nContextSwitchHoverThreadBefore) if(nThreadId == nContextSwitchHoverThreadAfter || nThreadId == nContextSwitchHoverThreadBefore)
nThreadColor = UI.nHoverColorShared|0x906060; nThreadColor = UI.nHoverColorShared|0x906060;

View File

@ -21,7 +21,7 @@ target_link_libraries(citra ${SDL2_LIBRARY} ${OPENGL_gl_LIBRARY} inih glad)
if (MSVC) if (MSVC)
target_link_libraries(citra getopt) target_link_libraries(citra getopt)
endif() endif()
target_link_libraries(citra ${PLATFORM_LIBRARIES}) target_link_libraries(citra ${PLATFORM_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD")
install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")

View File

@ -346,5 +346,11 @@ u32 GraphicsFramebufferWidget::BytesPerPixel(GraphicsFramebufferWidget::Format f
case Format::RGBA4: case Format::RGBA4:
case Format::D16: case Format::D16:
return 2; return 2;
default:
UNREACHABLE_MSG("GraphicsFramebufferWidget::BytesPerPixel: this "
"should not be reached as this function should "
"be given a format which is in "
"GraphicsFramebufferWidget::Format. Instead got %i",
static_cast<int>(format));
} }
} }

View File

@ -39,6 +39,7 @@ static void assert_noinline_call(const Fn& fn) {
}); } while (0) }); } while (0)
#define UNREACHABLE() ASSERT_MSG(false, "Unreachable code!") #define UNREACHABLE() ASSERT_MSG(false, "Unreachable code!")
#define UNREACHABLE_MSG(_a_, ...) ASSERT_MSG(false, _a_, __VA_ARGS__)
#ifdef _DEBUG #ifdef _DEBUG
#define DEBUG_ASSERT(_a_) ASSERT(_a_) #define DEBUG_ASSERT(_a_) ASSERT(_a_)
@ -49,3 +50,4 @@ static void assert_noinline_call(const Fn& fn) {
#endif #endif
#define UNIMPLEMENTED() DEBUG_ASSERT_MSG(false, "Unimplemented code!") #define UNIMPLEMENTED() DEBUG_ASSERT_MSG(false, "Unimplemented code!")
#define UNIMPLEMENTED_MSG(_a_, ...) ASSERT_MSG(false, _a_, __VA_ARGS__)

View File

@ -529,7 +529,7 @@ static void ReadRegister() {
id |= HexCharToValue(command_buffer[2]); id |= HexCharToValue(command_buffer[2]);
} }
if (id >= R0_REGISTER && id <= R15_REGISTER) { if (id <= R15_REGISTER) {
IntToGdbHex(reply, Core::g_app_core->GetReg(id)); IntToGdbHex(reply, Core::g_app_core->GetReg(id));
} else if (id == CPSR_REGISTER) { } else if (id == CPSR_REGISTER) {
IntToGdbHex(reply, Core::g_app_core->GetCPSR()); IntToGdbHex(reply, Core::g_app_core->GetCPSR());
@ -584,7 +584,7 @@ static void WriteRegister() {
id |= HexCharToValue(command_buffer[2]); id |= HexCharToValue(command_buffer[2]);
} }
if (id >= R0_REGISTER && id <= R15_REGISTER) { if (id <= R15_REGISTER) {
Core::g_app_core->SetReg(id, GdbHexToInt(buffer_ptr)); Core::g_app_core->SetReg(id, GdbHexToInt(buffer_ptr));
} else if (id == CPSR_REGISTER) { } else if (id == CPSR_REGISTER) {
Core::g_app_core->SetCPSR(GdbHexToInt(buffer_ptr)); Core::g_app_core->SetCPSR(GdbHexToInt(buffer_ptr));

View File

@ -250,7 +250,7 @@ static void CreateFile(Service::Interface* self) {
FileSys::Path file_path(filename_type, filename_size, filename_ptr); FileSys::Path file_path(filename_type, filename_size, filename_ptr);
LOG_DEBUG(Service_FS, "type=%d size=%llu data=%s", filename_type, filename_size, file_path.DebugStr().c_str()); LOG_DEBUG(Service_FS, "type=%d size=%llu data=%s", filename_type, file_size, file_path.DebugStr().c_str());
cmd_buff[1] = CreateFileInArchive(archive_handle, file_path, file_size).raw; cmd_buff[1] = CreateFileInArchive(archive_handle, file_path, file_size).raw;
} }

View File

@ -255,7 +255,7 @@ ResultStatus AppLoader_NCCH::Load() {
resource_limit_category = exheader_header.arm11_system_local_caps.resource_limit_category; resource_limit_category = exheader_header.arm11_system_local_caps.resource_limit_category;
LOG_INFO(Loader, "Name: %s" , exheader_header.codeset_info.name); LOG_INFO(Loader, "Name: %s" , exheader_header.codeset_info.name);
LOG_INFO(Loader, "Program ID: %016X" , ncch_header.program_id); LOG_INFO(Loader, "Program ID: %016llX" , ncch_header.program_id);
LOG_DEBUG(Loader, "Code compressed: %s" , is_compressed ? "yes" : "no"); LOG_DEBUG(Loader, "Code compressed: %s" , is_compressed ? "yes" : "no");
LOG_DEBUG(Loader, "Entry point: 0x%08X", entry_point); LOG_DEBUG(Loader, "Entry point: 0x%08X", entry_point);
LOG_DEBUG(Loader, "Code size: 0x%08X", code_size); LOG_DEBUG(Loader, "Code size: 0x%08X", code_size);

View File

@ -747,8 +747,13 @@ struct Regs {
case LightingSampler::ReflectGreen: case LightingSampler::ReflectGreen:
case LightingSampler::ReflectBlue: case LightingSampler::ReflectBlue:
return (config == LightingConfig::Config4) || (config == LightingConfig::Config5) || (config == LightingConfig::Config7); return (config == LightingConfig::Config4) || (config == LightingConfig::Config5) || (config == LightingConfig::Config7);
default:
UNREACHABLE_MSG("Regs::IsLightingSamplerSupported: Reached "
"unreachable section, sampler should be one "
"of Distribution0, Distribution1, Fresnel, "
"ReflectRed, ReflectGreen or ReflectBlue, instead "
"got %i", static_cast<int>(config));
} }
return false;
} }
struct { struct {