Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
41fec558
Unverified
Commit
41fec558
authored
Aug 14, 2018
by
Gennadiy Civil
Committed by
GitHub
Aug 14, 2018
Browse files
Merge pull request #1665 from rongjiecomputer/deprecate
Disable MSVC function deprecation when using Clang
parents
17714d65
2421eff9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
8 deletions
+24
-8
googletest/include/gtest/internal/gtest-port.h
googletest/include/gtest/internal/gtest-port.h
+18
-2
googletest/src/gtest-port.cc
googletest/src/gtest-port.cc
+2
-2
googletest/src/gtest.cc
googletest/src/gtest.cc
+2
-2
googletest/test/gtest_unittest.cc
googletest/test/gtest_unittest.cc
+2
-2
No files found.
googletest/include/gtest/internal/gtest-port.h
View file @
41fec558
...
@@ -329,6 +329,22 @@
...
@@ -329,6 +329,22 @@
# define GTEST_DISABLE_MSC_WARNINGS_POP_()
# define GTEST_DISABLE_MSC_WARNINGS_POP_()
#endif
#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
#ifndef GTEST_LANG_CXX11
// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
// -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a
// -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a
...
@@ -2484,7 +2500,7 @@ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
...
@@ -2484,7 +2500,7 @@ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
// Functions deprecated by MSVC 8.0.
// 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
)
{
inline
const
char
*
StrNCpy
(
char
*
dest
,
const
char
*
src
,
size_t
n
)
{
return
strncpy
(
dest
,
src
,
n
);
return
strncpy
(
dest
,
src
,
n
);
...
@@ -2532,7 +2548,7 @@ inline const char* GetEnv(const char* name) {
...
@@ -2532,7 +2548,7 @@ inline const char* GetEnv(const char* name) {
#endif
#endif
}
}
GTEST_DISABLE_MSC_
WARNINGS
_POP_
()
GTEST_DISABLE_MSC_
DEPRECATED
_POP_
()
#if GTEST_OS_WINDOWS_MOBILE
#if GTEST_OS_WINDOWS_MOBILE
// Windows CE has no C library. The abort() function is used in
// Windows CE has no C library. The abort() function is used in
...
...
googletest/src/gtest-port.cc
View file @
41fec558
...
@@ -942,7 +942,7 @@ GTestLog::~GTestLog() {
...
@@ -942,7 +942,7 @@ GTestLog::~GTestLog() {
// Disable Microsoft deprecation warnings for POSIX functions called from
// Disable Microsoft deprecation warnings for POSIX functions called from
// this class (creat, dup, dup2, and close)
// this class (creat, dup, dup2, and close)
GTEST_DISABLE_MSC_
WARNINGS
_PUSH_
(
4996
)
GTEST_DISABLE_MSC_
DEPRECATED
_PUSH_
()
#if GTEST_HAS_STREAM_REDIRECTION
#if GTEST_HAS_STREAM_REDIRECTION
...
@@ -1026,7 +1026,7 @@ class CapturedStream {
...
@@ -1026,7 +1026,7 @@ class CapturedStream {
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
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_stderr
=
NULL
;
static
CapturedStream
*
g_captured_stdout
=
NULL
;
static
CapturedStream
*
g_captured_stdout
=
NULL
;
...
...
googletest/src/gtest.cc
View file @
41fec558
...
@@ -860,9 +860,9 @@ TimeInMillis GetTimeInMillis() {
...
@@ -860,9 +860,9 @@ TimeInMillis GetTimeInMillis() {
// (deprecated function) there.
// (deprecated function) there.
// TODO(kenton@google.com): Use GetTickCount()? Or use
// TODO(kenton@google.com): Use GetTickCount()? Or use
// SystemTimeToFileTime()
// SystemTimeToFileTime()
GTEST_DISABLE_MSC_
WARNINGS
_PUSH_
(
4996
)
GTEST_DISABLE_MSC_
DEPRECATED
_PUSH_
()
_ftime64
(
&
now
);
_ftime64
(
&
now
);
GTEST_DISABLE_MSC_
WARNINGS
_POP_
()
GTEST_DISABLE_MSC_
DEPRECATED
_POP_
()
return
static_cast
<
TimeInMillis
>
(
now
.
time
)
*
1000
+
now
.
millitm
;
return
static_cast
<
TimeInMillis
>
(
now
.
time
)
*
1000
+
now
.
millitm
;
#elif GTEST_HAS_GETTIMEOFDAY_
#elif GTEST_HAS_GETTIMEOFDAY_
...
...
googletest/test/gtest_unittest.cc
View file @
41fec558
...
@@ -444,10 +444,10 @@ class FormatEpochTimeInMillisAsIso8601Test : public Test {
...
@@ -444,10 +444,10 @@ class FormatEpochTimeInMillisAsIso8601Test : public Test {
virtual void SetUp() {
virtual void SetUp() {
saved_tz_ = NULL;
saved_tz_ = NULL;
GTEST_DISABLE_MSC_
WARNINGS
_PUSH_
(
4996
/* getenv, strdup: deprecated */
)
GTEST_DISABLE_MSC_
DEPRECATED
_PUSH_(/* getenv, strdup: deprecated */)
if (getenv("TZ"))
if (getenv("TZ"))
saved_tz_ = strdup(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
// Set up the time zone for FormatEpochTimeInMillisAsIso8601 to use. We
// cannot use the local time zone because the function's output depends
// cannot use the local time zone because the function's output depends
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment