mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-22 16:37:40 +08:00
Void cast runtime-unused variables. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@268284 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -112,7 +112,7 @@ int main()
|
||||
std::throw_with_nested(Final());
|
||||
assert(false);
|
||||
}
|
||||
catch (const Final &f)
|
||||
catch (const Final &)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@@ -74,7 +74,7 @@ int main()
|
||||
throw A();
|
||||
assert(false);
|
||||
}
|
||||
catch (A& a)
|
||||
catch (A&)
|
||||
{
|
||||
std::exception_ptr p = std::current_exception();
|
||||
assert(A::constructed == 1);
|
||||
@@ -94,7 +94,7 @@ int main()
|
||||
throw A();
|
||||
assert(false);
|
||||
}
|
||||
catch (A a)
|
||||
catch (A)
|
||||
{
|
||||
std::exception_ptr p = std::current_exception();
|
||||
assert(A::constructed == 2);
|
||||
|
@@ -19,6 +19,7 @@
|
||||
int main()
|
||||
{
|
||||
std::jmp_buf jb;
|
||||
((void)jb); // Prevent unused warning
|
||||
static_assert((std::is_same<decltype(std::longjmp(jb, 0)), void>::value),
|
||||
"std::is_same<decltype(std::longjmp(jb, 0)), void>::value");
|
||||
}
|
||||
|
@@ -23,10 +23,13 @@
|
||||
int main()
|
||||
{
|
||||
std::clock_t c = 0;
|
||||
((void)c);
|
||||
std::size_t s = 0;
|
||||
std::time_t t = 0;
|
||||
std::tm tm = {0};
|
||||
((void)c); // Prevent unused warning
|
||||
((void)s); // Prevent unused warning
|
||||
((void)t); // Prevent unused warning
|
||||
((void)tm); // Prevent unused warning
|
||||
static_assert((std::is_same<decltype(std::clock()), std::clock_t>::value), "");
|
||||
static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), "");
|
||||
static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), "");
|
||||
@@ -39,5 +42,7 @@ int main()
|
||||
#endif
|
||||
char* c1 = 0;
|
||||
const char* c2 = 0;
|
||||
((void)c1); // Prevent unused warning
|
||||
((void)c2); // Prevent unused warning
|
||||
static_assert((std::is_same<decltype(std::strftime(c1,s,c2,&tm)), std::size_t>::value), "");
|
||||
}
|
||||
|
Reference in New Issue
Block a user