[PATCH] D59621: [libcxx] [test] Add (void) casts to operator new calls, to suppress warnings generated by [[nodiscard]].
Billy Robert O'Neal III via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 20 16:48:23 PDT 2019
BillyONeal created this revision.
BillyONeal added reviewers: EricWF, mclow.lists, ldionne.
Herald added a subscriber: jdoerfert.
Add (void) casts to operator new calls, to suppress warnings generated by [[nodiscard]].
This allows these tests to pass when compiled by MSVC++.
https://reviews.llvm.org/D59621
Files:
test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp
test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp
test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp
test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp
test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp
test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp
Index: test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp
===================================================================
--- test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp
+++ test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp
@@ -21,5 +21,5 @@
int main ()
{
- ::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);
}
Index: test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp
===================================================================
--- test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp
+++ test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp
@@ -21,5 +21,5 @@
int main ()
{
- ::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});
}
Index: test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp
===================================================================
--- test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp
+++ test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp
@@ -21,5 +21,5 @@
int main ()
{
- ::operator new[](4, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ (void)::operator new[](4, std::nothrow);
}
Index: test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp
===================================================================
--- test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp
+++ test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp
@@ -21,5 +21,5 @@
int main ()
{
- ::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);
}
Index: test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp
===================================================================
--- test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp
+++ test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp
@@ -21,5 +21,5 @@
int main ()
{
- ::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});
}
Index: test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp
===================================================================
--- test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp
+++ test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp
@@ -21,5 +21,5 @@
int main ()
{
- ::operator new[](4); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ (void)::operator new[](4);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59621.191607.patch
Type: text/x-patch
Size: 3592 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190320/ddb0f3ca/attachment.bin>
More information about the cfe-commits
mailing list