0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

virtual dtors == good

This commit is contained in:
Aaron 2009-02-18 13:42:32 -05:00
parent 7412a333fc
commit 593bf1f126
24 changed files with 46 additions and 5 deletions

View File

@ -301,7 +301,7 @@ if useJavaHome:
if nix:
env.Append( CPPFLAGS="-fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-non-virtual-dtor" )
env.Append( CPPFLAGS="-fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wnon-virtual-dtor" )
env.Append( LINKFLAGS=" -fPIC " )
env.Append( LIBS=[] )

View File

@ -123,6 +123,7 @@ namespace mongo {
*/
class DBConnector {
public:
virtual ~DBConnector() {}
virtual bool call( Message &toSend, Message &response, bool assertOk=true ) = 0;
virtual void say( Message &toSend ) = 0;
virtual void sayPiggyBack( Message &toSend ) = 0;

View File

@ -73,6 +73,7 @@ namespace mongo {
virtual bool requiresAuth() { return true; }
Command(const char *_name);
virtual ~Command() {}
};
bool runCommandAgainstRegistered(const char *ns, BSONObj& jsobj, BSONObjBuilder& anObjBuilder);

View File

@ -110,6 +110,7 @@ namespace mongo {
class AdvanceStrategy {
public:
virtual ~AdvanceStrategy() {}
virtual DiskLoc next( const DiskLoc &prev ) const = 0;
};

View File

@ -362,6 +362,7 @@ namespace mongo {
class FileOp {
public:
virtual ~FileOp() {}
virtual bool apply( const boost::filesystem::path &p ) = 0;
virtual const char * op() const = 0;
};

View File

@ -71,6 +71,7 @@ namespace mongo {
}
ReplPair(const char *remoteEnd, const char *arbiter);
virtual ~ReplPair() {}
bool dominant(const string& myname) {
if ( myname == remoteHost )

View File

@ -40,7 +40,7 @@ namespace mongo {
public:
bool isLocalHost;
AuthenticationInfo() { isLocalHost = false; }
~AuthenticationInfo() {
virtual ~AuthenticationInfo() {
}
void logout(const char *dbname) {
assert( dbMutexInfo.isLocked() );

View File

@ -121,6 +121,7 @@ namespace BtreeTests {
class SplitUnevenBucketBase : public Base {
public:
virtual ~SplitUnevenBucketBase() {}
void run() {
for ( int i = 0; i < 10; ++i ) {
BSONObj shortKey = simpleKey( shortToken( i ), 1 );

View File

@ -114,6 +114,7 @@ namespace JsobjTests {
class Base {
public:
virtual ~Base() {}
void run() {
ASSERT( valid().valid() );
ASSERT( !invalid().valid() );
@ -445,6 +446,7 @@ namespace JsobjTests {
class LabelBase {
public:
virtual ~LabelBase() {}
void run() {
ASSERT( !expected().woCompare( actual() ) );
}

View File

@ -326,6 +326,7 @@ namespace JsonTests {
class Base {
public:
virtual ~Base() {}
void run() {
ASSERT( fromjson( json() ).valid() );
assertEquals( bson(), fromjson( json() ) );
@ -348,6 +349,7 @@ namespace JsonTests {
class Bad {
public:
virtual ~Bad() {}
void run() {
ASSERT_EXCEPTION( fromjson( json() ), MsgAssertionException );
}
@ -427,6 +429,7 @@ namespace JsonTests {
class FancyNumber {
public:
virtual ~FancyNumber() {}
void run() {
ASSERT_EQUALS( int( 1000000 * bson().firstElement().number() ),
int( 1000000 * fromjson( json() ).firstElement().number() ) );

View File

@ -54,6 +54,7 @@ private:
class DirectDBClientConnection : public DBClientConnection {
public:
struct ConnectionCallback {
virtual ~ConnectionCallback() {}
virtual void beforeCommand() {}
virtual void afterCommand() {}
};

View File

@ -32,7 +32,7 @@ namespace NamespaceTests {
Base() {
setClient( ns() );
}
~Base() {
virtual ~Base() {
if ( id_.info.isNull() )
return;
theDataFileMgr.deleteRecord( ns(), id_.info.rec(), id_.info );
@ -379,7 +379,7 @@ namespace NamespaceTests {
class Base {
public:
Base( const char *ns = "foo" ) : ns_( ns ) {}
~Base() {
virtual ~Base() {
if ( !nsd() )
return;
string s( ns() );

View File

@ -232,6 +232,8 @@ namespace PairingTests {
} // namespace ReplPairTests
class DirectConnectBase : public Base {
public:
virtual ~DirectConnectBase() {}
protected:
void negotiate( ReplPair &a, ReplPair &b ) {
auto_ptr< DBClientConnection > c( new DirectDBClientConnection( &b, cc() ) );

View File

@ -33,7 +33,7 @@ namespace PdfileTests {
Base() {
setClient( ns() );
}
~Base() {
virtual ~Base() {
if ( !nsd() )
return;
string n( ns() );

View File

@ -26,6 +26,7 @@ namespace QueryOptimizerTests {
namespace FieldBoundTests {
class Base {
public:
virtual ~Base() {}
void run() {
FieldBoundSet s( query() );
checkElt( lower(), s.bound( "a" ).lower() );
@ -47,6 +48,7 @@ namespace QueryOptimizerTests {
class Bad {
public:
virtual ~Bad() {}
void run() {
ASSERT_EXCEPTION( FieldBoundSet f( query() ), AssertionException );
}

View File

@ -198,6 +198,7 @@ namespace QueryTests {
class Fail : public ClientBase {
public:
virtual ~Fail() {}
void run() {
prep();
ASSERT( !error() );

View File

@ -175,6 +175,7 @@ namespace ReplTests {
class Base : public ReplTests::Base {
public:
virtual ~Base() {}
void run() {
reset();
doIt();

View File

@ -111,6 +111,14 @@
936AB4BB0F3A5B0300D5015F /* update3.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = update3.js; sourceTree = "<group>"; };
936AB9350F3C8AB800D5015F /* _lodeRunner.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = _lodeRunner.js; sourceTree = "<group>"; };
936ABBAB0F3CBE5400D5015F /* dbNoCreate.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = dbNoCreate.js; sourceTree = "<group>"; };
936B89590F4C899400934AF2 /* file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = file.h; sourceTree = "<group>"; };
936B895A0F4C899400934AF2 /* md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md5.c; sourceTree = "<group>"; };
936B895B0F4C899400934AF2 /* md5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = "<group>"; };
936B895C0F4C899400934AF2 /* md5.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = md5.hpp; sourceTree = "<group>"; };
936B895D0F4C899400934AF2 /* md5main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md5main.c; sourceTree = "<group>"; };
936B895E0F4C899400934AF2 /* message.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = message.cpp; sourceTree = "<group>"; };
936B895F0F4C899400934AF2 /* message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = message.h; sourceTree = "<group>"; };
936B89600F4C899400934AF2 /* top.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = top.h; sourceTree = "<group>"; };
937CACE90F27BF4900C57AA6 /* socktests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = socktests.cpp; sourceTree = "<group>"; };
937D0E340F28CB070071FFA9 /* repltests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = repltests.cpp; sourceTree = "<group>"; };
937D14AB0F2A225F0071FFA9 /* nonce.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nonce.h; sourceTree = "<group>"; };
@ -400,6 +408,14 @@
934DD87B0EFAD23B00459CC1 /* util */ = {
isa = PBXGroup;
children = (
936B89590F4C899400934AF2 /* file.h */,
936B895A0F4C899400934AF2 /* md5.c */,
936B895B0F4C899400934AF2 /* md5.h */,
936B895C0F4C899400934AF2 /* md5.hpp */,
936B895D0F4C899400934AF2 /* md5main.c */,
936B895E0F4C899400934AF2 /* message.cpp */,
936B895F0F4C899400934AF2 /* message.h */,
936B89600F4C899400934AF2 /* top.h */,
934DD87C0EFAD23B00459CC1 /* background.cpp */,
934DD87D0EFAD23B00459CC1 /* background.h */,
934DD87F0EFAD23B00459CC1 /* builder.h */,

View File

@ -54,6 +54,7 @@ namespace mongo {
class Strategy {
public:
virtual ~Strategy() {}
virtual void queryOp( Request& r ) = 0;
virtual void getMore( Request& r ) = 0;
virtual void writeOp( int op , Request& r ) = 0;

View File

@ -26,6 +26,7 @@ namespace mongo {
public:
ShardKey( BSONObj fieldsAndOrder = emptyObj );
void init( BSONObj fieldsAndOrder );
virtual ~ShardKey() {}
void globalMin( BSONObjBuilder & b );
BSONObj globalMin(){ BSONObjBuilder b; globalMin( b ); return b.obj(); }

View File

@ -22,11 +22,13 @@ namespace mongo {
class Stringable {
public:
virtual ~Stringable() {}
virtual string toString() const = 0;
};
class Nullstream {
public:
virtual ~Nullstream() {}
// todo: just use a template for all these
virtual Nullstream& operator<<(const char *) {
return *this;

View File

@ -31,6 +31,7 @@ namespace mongo {
class Listener {
public:
Listener(int p) : port(p) { }
virtual ~Listener() {}
void listen(); // never returns (start a thread)
/* spawn a thread, etc., then return */

View File

@ -25,6 +25,7 @@ namespace mongo {
class MiniWebServer {
public:
MiniWebServer();
virtual ~MiniWebServer() {}
bool init(int port);
void run();

View File

@ -31,6 +31,7 @@ namespace mongo {
UnitTest() {
registerTest(this);
}
virtual ~UnitTest() {}
// assert if fails
virtual void run() = 0;