diff options
| author | Tobias Lippert <drtl@fastmail.fm> | 2013-08-15 22:27:46 +0200 |
|---|---|---|
| committer | Tor Lillqvist <tml@iki.fi> | 2013-08-15 20:57:12 +0000 |
| commit | 773ba28bfb3ce86dd2f9704d39d60b00d5f30b77 (patch) | |
| tree | fad0365797295712e5c4d5a34f4c5f5dbcead06e /include/cppunit | |
| parent | 89abdff7b0dcba8c050ce9ef7f68760511814f2f (diff) | |
| download | cppunit-773ba28bfb3ce86dd2f9704d39d60b00d5f30b77.tar.gz | |
Bug # 51154: cppunit warning cleaning
This patch allows to compile the code with gcc's -Weffc++
It consists mostly of making copy constructors and assignment operators
explicit and private, and of initializing all members in initializer lists.
Change-Id: I6f1cae812c58e3791c2386a1288501cf2f559610
Reviewed-on: https://gerrit.libreoffice.org/5424
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Tor Lillqvist <tml@iki.fi>
Diffstat (limited to 'include/cppunit')
| -rw-r--r-- | include/cppunit/Message.h | 4 | ||||
| -rw-r--r-- | include/cppunit/Protector.h | 2 | ||||
| -rw-r--r-- | include/cppunit/SynchronizedObject.h | 12 | ||||
| -rw-r--r-- | include/cppunit/XmlOutputter.h | 2 | ||||
| -rw-r--r-- | include/cppunit/ui/text/TextTestRunner.h | 6 |
5 files changed, 20 insertions, 6 deletions
diff --git a/include/cppunit/Message.h b/include/cppunit/Message.h index 7c462d5..5b5e4ec 100644 --- a/include/cppunit/Message.h +++ b/include/cppunit/Message.h @@ -38,7 +38,7 @@ CPPUNIT_NS_BEGIN class CPPUNIT_API Message { public: - Message(); + Message() {}; // Ensure thread-safe copy by detaching the string. Message( const Message &other ); @@ -57,7 +57,7 @@ public: const std::string &detail2, const std::string &detail3 ); - ~Message(); + virtual ~Message(); Message &operator =( const Message &other ); diff --git a/include/cppunit/Protector.h b/include/cppunit/Protector.h index d14e75f..c6d2e7c 100644 --- a/include/cppunit/Protector.h +++ b/include/cppunit/Protector.h @@ -84,6 +84,8 @@ public: ~ProtectorGuard(); private: + ProtectorGuard( const ProtectorGuard& ); /* not copyable */ + ProtectorGuard& operator=( const ProtectorGuard& ); /* not assignable */ TestResult *m_result; }; diff --git a/include/cppunit/SynchronizedObject.h b/include/cppunit/SynchronizedObject.h index 0f7d094..59c3cbb 100644 --- a/include/cppunit/SynchronizedObject.h +++ b/include/cppunit/SynchronizedObject.h @@ -50,15 +50,21 @@ protected: public: ExclusiveZone( SynchronizationObject *syncObject ) - : m_syncObject( syncObject ) + : m_syncObject( syncObject ) { - m_syncObject->lock(); + m_syncObject->lock(); } ~ExclusiveZone() { - m_syncObject->unlock (); + m_syncObject->unlock (); } + private: + /// Prevents the use of the copy constructor. + ExclusiveZone( const ExclusiveZone& ); + + /// Prevents the use of the copy operator. + ExclusiveZone& operator=( const ExclusiveZone& ); }; virtual void setSynchronizationObject( SynchronizationObject *syncObject ); diff --git a/include/cppunit/XmlOutputter.h b/include/cppunit/XmlOutputter.h index 0de9676..da8164a 100644 --- a/include/cppunit/XmlOutputter.h +++ b/include/cppunit/XmlOutputter.h @@ -46,7 +46,7 @@ public: */ XmlOutputter( TestResultCollector *result, OStream &stream, - std::string encoding = std::string("ISO-8859-1") ); + const std::string& encoding = std::string("ISO-8859-1") ); /// Destructor. virtual ~XmlOutputter(); diff --git a/include/cppunit/ui/text/TextTestRunner.h b/include/cppunit/ui/text/TextTestRunner.h index 86da4d4..6250166 100644 --- a/include/cppunit/ui/text/TextTestRunner.h +++ b/include/cppunit/ui/text/TextTestRunner.h @@ -86,6 +86,12 @@ protected: virtual void wait( bool doWait ); virtual void printResult( bool doPrintResult ); +private: + // prohibit copying + TextTestRunner( const TextTestRunner& ); + // prohibit copying + TextTestRunner& operator=( const TextTestRunner& ); + TestResultCollector *m_result; TestResult *m_eventManager; Outputter *m_outputter; |
