Disable MSVC function deprecation when using Clang
This commit is contained in:
		
							parent
							
								
									fb46a3f9d4
								
							
						
					
					
						commit
						3e978aa4bc
					
				@ -325,6 +325,22 @@
 | 
			
		||||
# define GTEST_DISABLE_MSC_WARNINGS_POP_()
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// Clang on Windows does not understand MSVC's pragma warning.
 | 
			
		||||
// We need clang-specific way to disable function deprecation warning.
 | 
			
		||||
#ifdef __clang__
 | 
			
		||||
# define GTEST_DISABLE_MSC_DEPRECATED_PUSH_()                         \
 | 
			
		||||
    _Pragma("clang diagnostic push")                                  \
 | 
			
		||||
    _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
 | 
			
		||||
    _Pragma("clang diagnostic ignored \"-Wdeprecated-implementations\"")
 | 
			
		||||
#define GTEST_DISABLE_MSC_DEPRECATED_POP_() \
 | 
			
		||||
    _Pragma("clang diagnostic pop")
 | 
			
		||||
#else
 | 
			
		||||
# define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \
 | 
			
		||||
    GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996)
 | 
			
		||||
# define GTEST_DISABLE_MSC_DEPRECATED_POP_() \
 | 
			
		||||
    GTEST_DISABLE_MSC_WARNINGS_POP_()
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef GTEST_LANG_CXX11
 | 
			
		||||
// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
 | 
			
		||||
// -std={c,gnu}++{0x,11} is passed.  The C++11 standard specifies a
 | 
			
		||||
@ -2483,7 +2499,7 @@ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
 | 
			
		||||
 | 
			
		||||
// Functions deprecated by MSVC 8.0.
 | 
			
		||||
 | 
			
		||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996 /* deprecated function */)
 | 
			
		||||
GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
 | 
			
		||||
 | 
			
		||||
inline const char* StrNCpy(char* dest, const char* src, size_t n) {
 | 
			
		||||
  return strncpy(dest, src, n);
 | 
			
		||||
@ -2531,7 +2547,7 @@ inline const char* GetEnv(const char* name) {
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GTEST_DISABLE_MSC_WARNINGS_POP_()
 | 
			
		||||
GTEST_DISABLE_MSC_DEPRECATED_POP_()
 | 
			
		||||
 | 
			
		||||
#if GTEST_OS_WINDOWS_MOBILE
 | 
			
		||||
// Windows CE has no C library. The abort() function is used in
 | 
			
		||||
 | 
			
		||||
@ -942,7 +942,7 @@ GTestLog::~GTestLog() {
 | 
			
		||||
 | 
			
		||||
// Disable Microsoft deprecation warnings for POSIX functions called from
 | 
			
		||||
// this class (creat, dup, dup2, and close)
 | 
			
		||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996)
 | 
			
		||||
GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
 | 
			
		||||
 | 
			
		||||
#if GTEST_HAS_STREAM_REDIRECTION
 | 
			
		||||
 | 
			
		||||
@ -1026,7 +1026,7 @@ class CapturedStream {
 | 
			
		||||
  GTEST_DISALLOW_COPY_AND_ASSIGN_(CapturedStream);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
GTEST_DISABLE_MSC_WARNINGS_POP_()
 | 
			
		||||
GTEST_DISABLE_MSC_DEPRECATED_POP_()
 | 
			
		||||
 | 
			
		||||
static CapturedStream* g_captured_stderr = NULL;
 | 
			
		||||
static CapturedStream* g_captured_stdout = NULL;
 | 
			
		||||
 | 
			
		||||
@ -860,9 +860,9 @@ TimeInMillis GetTimeInMillis() {
 | 
			
		||||
  // (deprecated function) there.
 | 
			
		||||
  // TODO(kenton@google.com): Use GetTickCount()?  Or use
 | 
			
		||||
  //   SystemTimeToFileTime()
 | 
			
		||||
  GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996)
 | 
			
		||||
  GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
 | 
			
		||||
  _ftime64(&now);
 | 
			
		||||
  GTEST_DISABLE_MSC_WARNINGS_POP_()
 | 
			
		||||
  GTEST_DISABLE_MSC_DEPRECATED_POP_()
 | 
			
		||||
 | 
			
		||||
  return static_cast<TimeInMillis>(now.time) * 1000 + now.millitm;
 | 
			
		||||
#elif GTEST_HAS_GETTIMEOFDAY_
 | 
			
		||||
 | 
			
		||||
@ -444,10 +444,10 @@ class FormatEpochTimeInMillisAsIso8601Test : public Test {
 | 
			
		||||
  virtual void SetUp() {
 | 
			
		||||
    saved_tz_ = NULL;
 | 
			
		||||
 | 
			
		||||
    GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996 /* getenv, strdup: deprecated */)
 | 
			
		||||
    GTEST_DISABLE_MSC_DEPRECATED_PUSH_(/* getenv, strdup: deprecated */)
 | 
			
		||||
    if (getenv("TZ"))
 | 
			
		||||
      saved_tz_ = strdup(getenv("TZ"));
 | 
			
		||||
    GTEST_DISABLE_MSC_WARNINGS_POP_()
 | 
			
		||||
    GTEST_DISABLE_MSC_DEPRECATED_POP_()
 | 
			
		||||
 | 
			
		||||
    // Set up the time zone for FormatEpochTimeInMillisAsIso8601 to use.  We
 | 
			
		||||
    // cannot use the local time zone because the function's output depends
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user