Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
37b97d1c
Commit
37b97d1c
authored
Dec 03, 2013
by
kosak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add MemorySanitizer annotations in gtest printers. Also remove unused variable…
Add MemorySanitizer annotations in gtest printers. Also remove unused variable kPathSeparatorString.
parent
aa34ae25
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
gtest-port.h
include/gtest/internal/gtest-port.h
+13
-0
gtest-filepath.cc
src/gtest-filepath.cc
+0
-2
gtest-printers.cc
src/gtest-printers.cc
+3
-0
No files found.
include/gtest/internal/gtest-port.h
View file @
37b97d1c
...
@@ -782,6 +782,19 @@ using ::std::tuple_size;
...
@@ -782,6 +782,19 @@ using ::std::tuple_size;
# define GTEST_HAS_CXXABI_H_ 0
# define GTEST_HAS_CXXABI_H_ 0
#endif
#endif
// A function level attribute to disable checking for use of uninitialized
// memory when built with MemorySanitizer.
#if defined(__clang__)
# if __has_feature(memory_sanitizer)
# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ \
__attribute__((no_sanitize_memory))
# else
# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
# endif
#else
# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
#endif
namespace
testing
{
namespace
testing
{
class
Message
;
class
Message
;
...
...
src/gtest-filepath.cc
View file @
37b97d1c
...
@@ -70,7 +70,6 @@ namespace internal {
...
@@ -70,7 +70,6 @@ namespace internal {
// of them.
// of them.
const
char
kPathSeparator
=
'\\'
;
const
char
kPathSeparator
=
'\\'
;
const
char
kAlternatePathSeparator
=
'/'
;
const
char
kAlternatePathSeparator
=
'/'
;
const
char
kPathSeparatorString
[]
=
"
\\
"
;
const
char
kAlternatePathSeparatorString
[]
=
"/"
;
const
char
kAlternatePathSeparatorString
[]
=
"/"
;
# if GTEST_OS_WINDOWS_MOBILE
# if GTEST_OS_WINDOWS_MOBILE
// Windows CE doesn't have a current directory. You should not use
// Windows CE doesn't have a current directory. You should not use
...
@@ -84,7 +83,6 @@ const char kCurrentDirectoryString[] = ".\\";
...
@@ -84,7 +83,6 @@ const char kCurrentDirectoryString[] = ".\\";
# endif // GTEST_OS_WINDOWS_MOBILE
# endif // GTEST_OS_WINDOWS_MOBILE
#else
#else
const
char
kPathSeparator
=
'/'
;
const
char
kPathSeparator
=
'/'
;
const
char
kPathSeparatorString
[]
=
"/"
;
const
char
kCurrentDirectoryString
[]
=
"./"
;
const
char
kCurrentDirectoryString
[]
=
"./"
;
#endif // GTEST_OS_WINDOWS
#endif // GTEST_OS_WINDOWS
...
...
src/gtest-printers.cc
View file @
37b97d1c
...
@@ -56,6 +56,7 @@ namespace {
...
@@ -56,6 +56,7 @@ namespace {
using
::
std
::
ostream
;
using
::
std
::
ostream
;
// Prints a segment of bytes in the given object.
// Prints a segment of bytes in the given object.
GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
void
PrintByteSegmentInObjectTo
(
const
unsigned
char
*
obj_bytes
,
size_t
start
,
void
PrintByteSegmentInObjectTo
(
const
unsigned
char
*
obj_bytes
,
size_t
start
,
size_t
count
,
ostream
*
os
)
{
size_t
count
,
ostream
*
os
)
{
char
text
[
5
]
=
""
;
char
text
[
5
]
=
""
;
...
@@ -252,6 +253,7 @@ void PrintTo(wchar_t wc, ostream* os) {
...
@@ -252,6 +253,7 @@ void PrintTo(wchar_t wc, ostream* os) {
// The array starts at begin, the length is len, it may include '\0' characters
// The array starts at begin, the length is len, it may include '\0' characters
// and may not be NUL-terminated.
// and may not be NUL-terminated.
template
<
typename
CharType
>
template
<
typename
CharType
>
GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
static
void
PrintCharsAsStringTo
(
static
void
PrintCharsAsStringTo
(
const
CharType
*
begin
,
size_t
len
,
ostream
*
os
)
{
const
CharType
*
begin
,
size_t
len
,
ostream
*
os
)
{
const
char
*
const
kQuoteBegin
=
sizeof
(
CharType
)
==
1
?
"
\"
"
:
"L
\"
"
;
const
char
*
const
kQuoteBegin
=
sizeof
(
CharType
)
==
1
?
"
\"
"
:
"L
\"
"
;
...
@@ -273,6 +275,7 @@ static void PrintCharsAsStringTo(
...
@@ -273,6 +275,7 @@ static void PrintCharsAsStringTo(
// Prints a (const) char/wchar_t array of 'len' elements, starting at address
// Prints a (const) char/wchar_t array of 'len' elements, starting at address
// 'begin'. CharType must be either char or wchar_t.
// 'begin'. CharType must be either char or wchar_t.
template
<
typename
CharType
>
template
<
typename
CharType
>
GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
static
void
UniversalPrintCharArray
(
static
void
UniversalPrintCharArray
(
const
CharType
*
begin
,
size_t
len
,
ostream
*
os
)
{
const
CharType
*
begin
,
size_t
len
,
ostream
*
os
)
{
// The code
// The code
...
...
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