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
074ed8c8
Commit
074ed8c8
authored
Nov 17, 2014
by
kosak
Browse files
Clang-on-Windows can support GTEST_ATTRIBUTE_UNUSED_.
parent
71271d2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
include/gtest/internal/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;
// compiler the variable/parameter does not have to be used.
#if defined(__GNUC__) && !defined(COMPILER_ICC)
# 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_
#endif
...
...
@@ -1041,16 +1046,22 @@ class Secret;
// the expression is false, most compilers will issue a warning/error
// 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
>
struct
CompileAssert
{
struct
CompileAssert
{
};
#define GTEST_COMPILE_ASSERT_(expr, msg) \
#
define GTEST_COMPILE_ASSERT_(expr, msg) \
typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \
msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_
#endif // !GTEST_LANG_CXX11
// 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
// 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