chronos38 / googlemock

Automatically exported from code.google.com/p/googlemock
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Warnings about unused parameters when compiling with -Wall -Wextra #75

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If you compile with gcc flags "-Wall -Wextra", you get lots and lots of
warnings about unused parameters, for example like this:

/usr/local/include/gmock/gmock-matchers.h: In instantiation of ‘void
testing::MatcherInterface<T>::ExplainMatchResultTo(T, std::ostream*) const
[with T = std::basic_string<char, std::char_traits<char>,
std::allocator<char> >]’:
/usr/local/include/gmock/gmock.h:90:   instantiated from here
/usr/local/include/gmock/gmock-matchers.h:93: warning: unused parameter ‘x’
/usr/local/include/gmock/gmock-matchers.h:93: warning: unused parameter ‘os’

It would be very nice if gmock didn't trigger these warnings.

I use gcc 4.3.2 and gmock 1.1.0.

Original issue reported on code.google.com by joel.ros...@gmail.com on 22 Sep 2009 at 3:51

GoogleCodeExporter commented 9 years ago

Original comment by zhanyong...@gmail.com on 22 Sep 2009 at 4:20

GoogleCodeExporter commented 9 years ago
I just checked the trunk head.  Compiling it with -Wall -Wextra using g++ 4.2.4 
generates no warning.  I think it was already fixed in trunk.

Original comment by zhanyong...@gmail.com on 23 Sep 2009 at 10:26

GoogleCodeExporter commented 9 years ago
Confirmed, r127 fixes most of them. I found one more that is still left, though:

--- gmock-matchers.h.orig   2009-09-24 09:39:32.000000000 +0200
+++ gmock-matchers.h    2009-09-24 09:39:51.000000000 +0200
@@ -1611,7 +1611,7 @@
   typedef typename Functor::result_type ResultType;
   typedef Functor StorageType;

-  static void CheckIsValid(Functor functor) {}
+  static void CheckIsValid(Functor /* functor */) {}
   template <typename T>
   static ResultType Invoke(Functor f, T arg) { return f(arg); }
 };

Original comment by joel.ros...@gmail.com on 24 Sep 2009 at 7:41