Get rid of all warnings with MSVC and clang-cl (#2177)
This commit is contained in:
parent
75de196cec
commit
fd593d5f08
@ -75,7 +75,7 @@ endif()
|
|||||||
|
|
||||||
# Precompiled header macro. Parameters are source file list and filename for pch cpp file.
|
# Precompiled header macro. Parameters are source file list and filename for pch cpp file.
|
||||||
macro(glslang_pch SRCS PCHCPP)
|
macro(glslang_pch SRCS PCHCPP)
|
||||||
if(MSVC AND CMAKE_GENERATOR MATCHES "^Visual Studio" AND ENABLE_PCH)
|
if(MSVC AND CMAKE_GENERATOR MATCHES "^Visual Studio" AND NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND ENABLE_PCH)
|
||||||
set(PCH_NAME "$(IntDir)\\pch.pch")
|
set(PCH_NAME "$(IntDir)\\pch.pch")
|
||||||
# make source files use/depend on PCH_NAME
|
# make source files use/depend on PCH_NAME
|
||||||
set_source_files_properties(${${SRCS}} PROPERTIES COMPILE_FLAGS "/Yupch.h /FIpch.h /Fp${PCH_NAME} /Zm300" OBJECT_DEPENDS "${PCH_NAME}")
|
set_source_files_properties(${${SRCS}} PROPERTIES COMPILE_FLAGS "/Yupch.h /FIpch.h /Fp${PCH_NAME} /Zm300" OBJECT_DEPENDS "${PCH_NAME}")
|
||||||
@ -124,14 +124,14 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
|
|||||||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0")
|
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0")
|
||||||
add_compile_options(-Werror=deprecated-copy)
|
add_compile_options(-Werror=deprecated-copy)
|
||||||
endif()
|
endif()
|
||||||
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
|
||||||
add_compile_options(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs
|
add_compile_options(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs
|
||||||
-Wunused-parameter -Wunused-value -Wunused-variable)
|
-Wunused-parameter -Wunused-value -Wunused-variable)
|
||||||
add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over.
|
add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over.
|
||||||
if(NOT ENABLE_RTTI)
|
if(NOT ENABLE_RTTI)
|
||||||
add_compile_options(-fno-rtti)
|
add_compile_options(-fno-rtti)
|
||||||
endif()
|
endif()
|
||||||
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC")
|
elseif(MSVC)
|
||||||
if(NOT ENABLE_RTTI)
|
if(NOT ENABLE_RTTI)
|
||||||
add_compile_options(/GR-) # Disable RTTI
|
add_compile_options(/GR-) # Disable RTTI
|
||||||
endif()
|
endif()
|
||||||
@ -142,7 +142,7 @@ if(ENABLE_GLSLANG_JS)
|
|||||||
add_compile_options(/Os /GR-)
|
add_compile_options(/Os /GR-)
|
||||||
else()
|
else()
|
||||||
add_compile_options(-Os -fno-exceptions)
|
add_compile_options(-Os -fno-exceptions)
|
||||||
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
|
||||||
add_compile_options(-Wno-unused-parameter)
|
add_compile_options(-Wno-unused-parameter)
|
||||||
add_compile_options(-Wno-unused-variable -Wno-unused-const-variable)
|
add_compile_options(-Wno-unused-variable -Wno-unused-const-variable)
|
||||||
endif()
|
endif()
|
||||||
|
@ -37,6 +37,14 @@ const glslang_resource_t* glslang_default_resource(void)
|
|||||||
return reinterpret_cast<const glslang_resource_t*>(&glslang::DefaultTBuiltInResource);
|
return reinterpret_cast<const glslang_resource_t*>(&glslang::DefaultTBuiltInResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__clang__) || defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4996)
|
||||||
|
#endif
|
||||||
|
|
||||||
const char* glslang_default_resource_string()
|
const char* glslang_default_resource_string()
|
||||||
{
|
{
|
||||||
std::string cpp_str = glslang::GetDefaultTBuiltInResourceString();
|
std::string cpp_str = glslang::GetDefaultTBuiltInResourceString();
|
||||||
@ -45,6 +53,12 @@ const char* glslang_default_resource_string()
|
|||||||
return c_str;
|
return c_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__clang__) || defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
void glslang_decode_resource_limits(glslang_resource_t* resources, char* config)
|
void glslang_decode_resource_limits(glslang_resource_t* resources, char* config)
|
||||||
{
|
{
|
||||||
glslang::DecodeResourceLimits(reinterpret_cast<TBuiltInResource*>(resources), config);
|
glslang::DecodeResourceLimits(reinterpret_cast<TBuiltInResource*>(resources), config);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user