Skip to content
Draft
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
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ if(WIN32)
add_compile_options(/guard:cf)
add_link_options(/guard:cf)
else()
add_compile_options(-fcf-protection)
if(LLVM_NATIVE_ARCH MATCHES "X86")
add_compile_options(-fcf-protection)
endif()
endif()
endif(WIN32)

Expand Down
10 changes: 10 additions & 0 deletions cmake/modules/HandleLLVMOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )

if (LLVM_BUILD_STATIC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
if(MINGW)
# We want to mimic MSVC standalone build here
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static")
endif()
endif()

if( XCODE )
Expand Down Expand Up @@ -425,12 +429,18 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
append("-Wno-unknown-pragmas" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)

if (MINGW)
append("-Wno-cast-function-type-mismatch" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
append("-Wno-implicit-fallthrough" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
append("-Wno-missing-exception-spec" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
append("-Wno-reorder-ctor" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
append("-Wno-sign-compare" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
append("-Wno-unused-const-variable" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
append("-Wno-unused-function" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
append("-Wno-unused-private-field" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
append("-Wno-gnu-zero-variadic-macro-arguments" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
endif()

add_flag_if_supported("-Wno-unused-but-set-variable" UNUSED_BUT_SET_VARIABLE)
Expand Down
8 changes: 4 additions & 4 deletions include/dxc/Support/Global.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ template <typename T> T *VerifyNullAndThrow(T *p) {
}
#define VNT(__p) VerifyNullAndThrow(__p)

#ifdef _MSC_VER
#ifdef _WIN32

extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(
const char *msg);
Expand Down Expand Up @@ -270,7 +270,7 @@ inline void OutputDebugFormatA(const char *pszFormat, ...) {

va_list argList;
va_start(argList, pszFormat);
int count = vsnprintf_s(buffer, bufferSize, pszFormat, argList);
int count = vsnprintf_s(buffer, bufferSize, bufferSize, pszFormat, argList);
va_end(argList);

OutputDebugStringA(buffer);
Expand All @@ -279,7 +279,7 @@ inline void OutputDebugFormatA(const char *pszFormat, ...) {
}
}

#endif // _MSC_VER
#endif // _WIN32

#ifndef NDEBUG

Expand All @@ -302,7 +302,7 @@ inline void OutputDebugFormatA(const char *pszFormat, ...) {
if (!(exp)) { \
OutputDebugFormatA( \
"Error: \t%s\nFile:\n%s(%d)\nFunc:\t%s.\n\t" fmt "\n", \
"!(" #exp ")", __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__); \
"!(" #exp ")", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); \
__debugbreak(); \
} \
} while (0)
Expand Down
Loading
Loading