From 82e238eecb9e30b6bd7da71f4445610d3ca0deec Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Wed, 20 Mar 2019 23:58:46 +0000 Subject: [PATCH] [libcxx] [test] Add (void) casts to operator new calls, to suppress warnings generated by [[nodiscard]]. This allows these tests to pass when compiled by MSVC++. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356632 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../support.dynamic/new.delete/new.delete.array/new_size.sh.cpp | 2 +- .../new.delete/new.delete.array/new_size_align.sh.cpp | 2 +- .../new.delete/new.delete.array/new_size_align_nothrow.sh.cpp | 2 +- .../new.delete/new.delete.array/new_size_nothrow.sh.cpp | 2 +- .../new.delete/new.delete.single/new_size_align.sh.cpp | 2 +- .../new.delete/new.delete.single/new_size_align_nothrow.sh.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp index a04ceb6ad..d1c6ced4b 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp @@ -21,7 +21,7 @@ int main(int, char**) { - ::operator new[](4); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} + (void)::operator new[](4); return 0; } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp index e2a61591a..090cbd8d8 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp @@ -21,7 +21,7 @@ int main(int, char**) { - ::operator new[](4, std::align_val_t{4}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} + (void)::operator new[](4, std::align_val_t{4}); return 0; } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp index 5ad81863d..2e222974b 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp @@ -21,7 +21,7 @@ int main(int, char**) { - ::operator new[](4, std::align_val_t{4}, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} + (void)::operator new[](4, std::align_val_t{4}, std::nothrow); return 0; } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp index 53af2c764..72d574495 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp @@ -21,7 +21,7 @@ int main(int, char**) { - ::operator new[](4, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} + (void)::operator new[](4, std::nothrow); return 0; } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp index a0d99c76d..b15f1da0b 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp @@ -21,7 +21,7 @@ int main(int, char**) { - ::operator new(4, std::align_val_t{4}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} + (void)::operator new(4, std::align_val_t{4}); return 0; } diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp index 54b25ac55..ae801857c 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp @@ -21,7 +21,7 @@ int main(int, char**) { - ::operator new(4, std::align_val_t{4}, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} + (void)::operator new(4, std::align_val_t{4}, std::nothrow); return 0; }