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
074ed8c8
Commit
074ed8c8
authored
Nov 17, 2014
by
kosak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clang-on-Windows can support GTEST_ATTRIBUTE_UNUSED_.
parent
71271d2c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
gtest-port.h
include/gtest/internal/gtest-port.h
+14
-3
No files found.
include/gtest/internal/gtest-port.h
View file @
074ed8c8
...
@@ -879,7 +879,12 @@ using ::std::tuple_size;
...
@@ -879,7 +879,12 @@ using ::std::tuple_size;
// compiler the variable/parameter does not have to be used.
// compiler the variable/parameter does not have to be used.
#if defined(__GNUC__) && !defined(COMPILER_ICC)
#if defined(__GNUC__) && !defined(COMPILER_ICC)
# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
#else
#elif defined(__clang__)
# if __has_attribute(unused)
# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
# endif
#endif
#ifndef GTEST_ATTRIBUTE_UNUSED_
# define GTEST_ATTRIBUTE_UNUSED_
# define GTEST_ATTRIBUTE_UNUSED_
#endif
#endif
...
@@ -1041,16 +1046,22 @@ class Secret;
...
@@ -1041,16 +1046,22 @@ class Secret;
// the expression is false, most compilers will issue a warning/error
// the expression is false, most compilers will issue a warning/error
// containing the name of the variable.
// containing the name of the variable.
#if GTEST_LANG_CXX11
# define GTEST_COMPILE_ASSERT_(expr, msg) static_assert(expr, #msg)
#else // !GTEST_LANG_CXX11
template
<
bool
>
template
<
bool
>
struct
CompileAssert
{
struct
CompileAssert
{
};
};
#define GTEST_COMPILE_ASSERT_(expr, msg) \
#
define GTEST_COMPILE_ASSERT_(expr, msg) \
typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \
typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \
msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_
msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_
#endif // !GTEST_LANG_CXX11
// Implementation details of GTEST_COMPILE_ASSERT_:
// Implementation details of GTEST_COMPILE_ASSERT_:
//
//
// (In C++11, we simply use static_assert instead of the following)
//
// - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1
// - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1
// elements (and thus is invalid) when the expression is false.
// elements (and thus is invalid) when the expression is false.
//
//
...
...
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