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)


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)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to