Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ if(MSVC)
if(NO_WCHAR_T)
message(STATUS "Using non-native wchar_t as unsigned short")
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE "/Zc:wchar_t-")
target_compile_options(${t} PRIVATE /Zc:wchar_t-)
endforeach()
endif()
endif()
Expand All @@ -477,13 +477,14 @@ endforeach()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|IntelLLVM")
set(WarningsLib -Wall -Wpedantic -Wextra)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
list(APPEND WarningsLib "-Wno-unsafe-buffer-usage")
list(APPEND WarningsLib -Wno-unsafe-buffer-usage)
endif()
target_compile_options(${PROJECT_NAME} PRIVATE ${WarningsLib})

set(WarningsEXE ${WarningsLib} "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" "-Wno-switch-default"
"-Wno-double-promotion" "-Wno-exit-time-destructors" "-Wno-gnu-anonymous-struct"
"-Wno-missing-prototypes" "-Wno-nested-anon-types" "-Wno-unused-const-variable")
set(WarningsEXE ${WarningsLib}
-Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-switch-default
-Wno-double-promotion -Wno-exit-time-destructors -Wno-gnu-anonymous-struct
-Wno-missing-prototypes -Wno-nested-anon-types -Wno-unused-const-variable -Wno-padded)
foreach(t IN LISTS TOOL_EXES)
target_compile_options(${t} PRIVATE ${WarningsEXE})
endforeach()
Expand Down
13 changes: 9 additions & 4 deletions Src/PlatformHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <cstdio>
#include <exception>
#include <memory>
#include <string>

#ifndef MAKEFOURCC
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
Expand All @@ -41,19 +42,23 @@ namespace DirectX
class com_exception : public std::exception
{
public:
com_exception(HRESULT hr) noexcept : result(hr) {}
explicit com_exception(HRESULT hr) : result(hr)
{
char str[64] = {};
sprintf_s(str, "Failure with HRESULT of %08X", static_cast<unsigned int>(result));
message = str;
}

const char* what() const noexcept override
{
static char s_str[64] = {};
sprintf_s(s_str, "Failure with HRESULT of %08X", static_cast<unsigned int>(result));
return s_str;
return message.c_str();
}

HRESULT get_result() const noexcept { return result; }

private:
HRESULT result;
std::string message;
};

// Helper utility converts D3D API failures into exceptions.
Expand Down
1 change: 1 addition & 0 deletions Src/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
#pragma clang diagnostic ignored "-Wmicrosoft-include"
#pragma clang diagnostic ignored "-Wnested-anon-types"
#pragma clang diagnostic ignored "-Wpadded"
#pragma clang diagnostic ignored "-Wreserved-id-macro"
#pragma clang diagnostic ignored "-Wswitch-enum"
#pragma clang diagnostic ignored "-Wunknown-pragmas"
Expand Down
Loading