mirror of
https://github.com/Kitware/CMake.git
synced 2025-05-08 22:37:04 +08:00
Fixing warnings generated by clang 8.0 on Windows
* Deprecation removals previously specific to MSVC/Intel now also used by clang * String literals were assigned to non const pointers. These are stored in mutable arrays now * An implicit function pointer to pointer conversion is a Microsoft extension warning is suppressed by an explicit reinterpret_cast * The MSVC specific deprecation macro for jsoncpp was moved after the clang macro to avoid redefinition warnings. This is consistent with how jsoncpp fixed the issue in 36d8cfd7
This commit is contained in:
parent
067a4f484b
commit
4fe34b2d29
@ -8,11 +8,16 @@ if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Intel")
|
||||
set(_INTEL_WINDOWS 1)
|
||||
endif()
|
||||
|
||||
if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Clang"
|
||||
AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
|
||||
set(_CLANG_MSVC_WINDOWS 1)
|
||||
endif()
|
||||
|
||||
# Disable deprecation warnings for standard C functions.
|
||||
# really only needed for newer versions of VS, but should
|
||||
# not hurt other versions, and this will work into the
|
||||
# future
|
||||
if(MSVC OR _INTEL_WINDOWS)
|
||||
if(MSVC OR _INTEL_WINDOWS OR _CLANG_MSVC_WINDOWS)
|
||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
else()
|
||||
endif()
|
||||
@ -21,9 +26,7 @@ if(MSVC)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stack:10000000")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL Clang
|
||||
AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
|
||||
AND "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
|
||||
if(_CLANG_MSVC_WINDOWS AND "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Xlinker -stack:20000000")
|
||||
endif()
|
||||
|
||||
|
@ -61,7 +61,8 @@ HRESULT InstanceCallMacro(IDispatch* vsIDE, const std::string& macro,
|
||||
|
||||
if (0 != vsIDE) {
|
||||
DISPID dispid = (DISPID)-1;
|
||||
OLECHAR* name = L"ExecuteCommand";
|
||||
wchar_t execute_command[] = L"ExecuteCommand";
|
||||
OLECHAR* name = execute_command;
|
||||
|
||||
hr =
|
||||
vsIDE->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &dispid);
|
||||
@ -119,7 +120,8 @@ HRESULT InstanceCallMacro(IDispatch* vsIDE, const std::string& macro,
|
||||
}
|
||||
oss << " dwHelpContext: " << excep.dwHelpContext << std::endl;
|
||||
oss << " pvReserved: " << excep.pvReserved << std::endl;
|
||||
oss << " pfnDeferredFillIn: " << excep.pfnDeferredFillIn << std::endl;
|
||||
oss << " pfnDeferredFillIn: "
|
||||
<< reinterpret_cast<void*>(excep.pfnDeferredFillIn) << std::endl;
|
||||
oss << " scode: " << excep.scode << std::endl;
|
||||
}
|
||||
|
||||
@ -140,7 +142,8 @@ HRESULT GetSolutionObject(IDispatch* vsIDE, IDispatchPtr& vsSolution)
|
||||
|
||||
if (0 != vsIDE) {
|
||||
DISPID dispid = (DISPID)-1;
|
||||
OLECHAR* name = L"Solution";
|
||||
wchar_t solution[] = L"Solution";
|
||||
OLECHAR* name = solution;
|
||||
|
||||
hr =
|
||||
vsIDE->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &dispid);
|
||||
@ -183,7 +186,8 @@ HRESULT GetSolutionFullName(IDispatch* vsSolution, std::string& fullName)
|
||||
|
||||
if (0 != vsSolution) {
|
||||
DISPID dispid = (DISPID)-1;
|
||||
OLECHAR* name = L"FullName";
|
||||
wchar_t full_name[] = L"FullName";
|
||||
OLECHAR* name = full_name;
|
||||
|
||||
hr = vsSolution->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_USER_DEFAULT,
|
||||
&dispid);
|
||||
|
@ -535,11 +535,22 @@ void cmGlobalGenerator::EnableLanguage(
|
||||
|
||||
# ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4996)
|
||||
# ifdef __INTEL_COMPILER
|
||||
# pragma warning(disable : 1478)
|
||||
# elif defined __clang__
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
# else
|
||||
# pragma warning(disable : 4996)
|
||||
# endif
|
||||
# endif
|
||||
GetVersionExW((OSVERSIONINFOW*)&osviex);
|
||||
# ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
|
||||
# pragma warning(pop)
|
||||
# ifdef __clang__
|
||||
# pragma clang diagnostic pop
|
||||
# else
|
||||
# pragma warning(pop)
|
||||
# endif
|
||||
# endif
|
||||
std::ostringstream windowsVersionString;
|
||||
windowsVersionString << osviex.dwMajorVersion << "."
|
||||
|
@ -79,11 +79,6 @@
|
||||
# pragma warning(disable : 4786)
|
||||
# endif // MSVC 6
|
||||
|
||||
# if _MSC_VER >= 1500 // MSVC 2008
|
||||
/// Indicates that the following function is deprecated.
|
||||
# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
|
||||
# endif
|
||||
|
||||
#endif // defined(_MSC_VER)
|
||||
|
||||
// In c++11 the override keyword allows you to explicity define that a function
|
||||
@ -137,7 +132,10 @@
|
||||
# elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
|
||||
# define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
|
||||
# endif // GNUC version
|
||||
#endif // __clang__ || __GNUC__
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008
|
||||
/// Indicates that the following function is deprecated.
|
||||
# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
|
||||
#endif // __clang__ || __GNUC__ || _MSC_VER
|
||||
|
||||
#undef JSONCPP_DEPRECATED // no deprecations in CMake copy
|
||||
#if !defined(JSONCPP_DEPRECATED)
|
||||
|
Loading…
x
Reference in New Issue
Block a user