[PATCH] D21585: [libcxx] [test] Silence MSVC's spurious "warning C4100: 'p': unreferenced formal parameter".

Stephan T. Lavavej via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 21 17:59:40 PDT 2016


STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

Silence MSVC's spurious "warning C4100: 'p': unreferenced formal parameter".

This is a C1XX bug, tracked by VSO#188582. C1XX has found some good issues, so I would like to ask for this one-line warning suppression to make my life easier.

http://reviews.llvm.org/D21585

Files:
  test/support/test_allocator.h

Index: test/support/test_allocator.h
===================================================================
--- test/support/test_allocator.h
+++ test/support/test_allocator.h
@@ -87,7 +87,11 @@
     template <class U> void construct(pointer p, U&& val)
         {::new(static_cast<void*>(p)) T(std::forward<U>(val));}
 #endif
-    void destroy(pointer p) {p->~T();}
+    void destroy(pointer p)
+        {
+            p->~T();
+            ((void)p); // Prevent MSVC's spurious unused warning
+        }
     friend bool operator==(const test_allocator& x, const test_allocator& y)
         {return x.data_ == y.data_;}
     friend bool operator!=(const test_allocator& x, const test_allocator& y)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21585.61478.patch
Type: text/x-patch
Size: 697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160622/bd584f35/attachment.bin>


More information about the cfe-commits mailing list