mirror of https://github.com/mongodb/mongo
Changes to source needed to compile cleanly with clang++
This commit is contained in:
parent
8b947f035d
commit
2b58bd8904
|
|
@ -398,7 +398,7 @@ namespace mongo {
|
|||
break;
|
||||
case RegEx: {
|
||||
const char *p = value();
|
||||
size_t len1 = ( maxLen == -1 ) ? strlen( p ) : mongo::strnlen( p, remain );
|
||||
size_t len1 = ( maxLen == -1 ) ? strlen( p ) : (size_t)mongo::strnlen( p, remain );
|
||||
//massert( 10318 , "Invalid regex string", len1 != -1 ); // ERH - 4/28/10 - don't think this does anything
|
||||
p = p + len1 + 1;
|
||||
size_t len2;
|
||||
|
|
|
|||
|
|
@ -213,11 +213,11 @@ namespace mongo {
|
|||
|
||||
log() << "Initializing lock with skew of " << skew << " for thread " << threadId << endl;
|
||||
|
||||
lock.reset(new DistributedLock(hostConn, lockName, legacy ? takeoverMins : takeoverMS, true, legacy));
|
||||
lock.reset(new DistributedLock(hostConn, lockName, legacy ? (unsigned long long)takeoverMins : takeoverMS, true, legacy));
|
||||
|
||||
log() << "Skewed time " << jsTime() << " for thread " << threadId << endl
|
||||
<< " max wait (with lock: " << threadWait << ", after lock: " << threadSleep << ")" << endl
|
||||
<< " takeover in " << (legacy ? takeoverMins : takeoverMS) << (legacy ? " (mins local)" : "(ms remote)") << endl;
|
||||
<< " takeover in " << (legacy ? (unsigned long long)takeoverMins : takeoverMS) << (legacy ? " (mins local)" : "(ms remote)") << endl;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ namespace mongo {
|
|||
|
||||
result << "errors" << errors
|
||||
<< "skew" << skew
|
||||
<< "takeover" << (long long) (legacy ? takeoverMS : takeoverMins)
|
||||
<< "takeover" << (long long) (legacy ? takeoverMS : (unsigned long long)takeoverMins)
|
||||
<< "localTimeout" << (takeoverMS > 0);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1108,7 +1108,7 @@ namespace mongo {
|
|||
qr->startingFrom = 0;
|
||||
qr->nReturned = n;
|
||||
result.setData( qr.release(), true );
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ namespace mongo {
|
|||
log() << "replSet ~RSBase called" << rsLog;
|
||||
}
|
||||
|
||||
public:
|
||||
class lock {
|
||||
RSBase& rsbase;
|
||||
auto_ptr<scoped_lock> sl;
|
||||
|
|
@ -157,7 +158,6 @@ namespace mongo {
|
|||
}
|
||||
};
|
||||
|
||||
public:
|
||||
/* for asserts */
|
||||
bool locked() const { return _locked != 0; }
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ namespace mongo {
|
|||
void ReplSetConfig::MemberCfg::check() const {
|
||||
mchk(_id >= 0 && _id <= 255);
|
||||
mchk(priority >= 0 && priority <= 1000);
|
||||
mchk(votes >= 0 && votes <= 100);
|
||||
mchk(votes <= 100); // votes >= 0 because it is unsigned
|
||||
uassert(13419, "this version of mongod only supports priorities 0 and 1", priority == 0 || priority == 1);
|
||||
uassert(13437, "slaveDelay requires priority be zero", slaveDelay == 0 || priority == 0);
|
||||
uassert(13438, "bad slaveDelay value", slaveDelay >= 0 && slaveDelay <= 3600 * 24 * 366);
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ namespace mongo {
|
|||
<< "\t write"
|
||||
<< "\t\t" << terseCurrentTime()
|
||||
<< endl;
|
||||
for ( unsigned i=data.size()-1; i>=0 && data.size() - i < 10 ; i-- ) {
|
||||
for ( int i=data.size()-1; i>=0 && data.size() - i < 10 ; i-- ) {
|
||||
cout << setw(longest) << data[i].ns
|
||||
<< "\t" << setprecision(3) << ( data[i].timeDiff / ( 1000 * _sleep ) ) << "%"
|
||||
<< "\t" << setprecision(3) << data[i].percentTime( "readLock" , _sleep) << "%"
|
||||
|
|
|
|||
|
|
@ -20,6 +20,13 @@
|
|||
|
||||
#include "../db/lasterror.h"
|
||||
|
||||
// MONGO_NORETURN undefed at end of file
|
||||
#ifdef __GNUC__
|
||||
# define MONGO_NORETURN __attribute__((__noreturn__))
|
||||
#else
|
||||
# define MONGO_NORETURN
|
||||
#endif
|
||||
|
||||
namespace mongo {
|
||||
|
||||
enum CommonErrorCodes {
|
||||
|
|
@ -117,14 +124,13 @@ namespace mongo {
|
|||
virtual void appendPrefix( stringstream& ss ) const { ss << "massert:"; }
|
||||
};
|
||||
|
||||
|
||||
void asserted(const char *msg, const char *file, unsigned line);
|
||||
void asserted(const char *msg, const char *file, unsigned line) MONGO_NORETURN;
|
||||
void wasserted(const char *msg, const char *file, unsigned line);
|
||||
|
||||
/** a "user assertion". throws UserAssertion. logs. typically used for errors that a user
|
||||
could cause, such as dupliate key, disk full, etc.
|
||||
*/
|
||||
void uasserted(int msgid, const char *msg);
|
||||
void uasserted(int msgid, const char *msg) MONGO_NORETURN;
|
||||
inline void uasserted(int msgid , string msg) { uasserted(msgid, msg.c_str()); }
|
||||
|
||||
/** reported via lasterror, but don't throw exception */
|
||||
|
|
@ -133,9 +139,9 @@ namespace mongo {
|
|||
/** msgassert and massert are for errors that are internal but have a well defined error text string.
|
||||
a stack trace is logged.
|
||||
*/
|
||||
void msgassertedNoTrace(int msgid, const char *msg);
|
||||
void msgassertedNoTrace(int msgid, const char *msg) MONGO_NORETURN;
|
||||
inline void msgassertedNoTrace(int msgid, const string& msg) { msgassertedNoTrace( msgid , msg.c_str() ); }
|
||||
void msgasserted(int msgid, const char *msg);
|
||||
void msgasserted(int msgid, const char *msg) MONGO_NORETURN;
|
||||
inline void msgasserted(int msgid, string msg) { msgasserted(msgid, msg.c_str()); }
|
||||
|
||||
#ifdef assert
|
||||
|
|
@ -183,7 +189,7 @@ namespace mongo {
|
|||
enum { ASSERT_ID_DUPKEY = 11000 };
|
||||
|
||||
/* throws a uassertion with an appropriate msg */
|
||||
void streamNotGood( int code , string msg , std::ios& myios );
|
||||
void streamNotGood( int code , string msg , std::ios& myios ) MONGO_NORETURN;
|
||||
|
||||
inline void assertStreamGood(unsigned msgid, string msg, std::ios& myios) {
|
||||
if( !myios.good() ) streamNotGood(msgid, msg, myios);
|
||||
|
|
@ -227,3 +233,5 @@ namespace mongo {
|
|||
|
||||
#define MONGO_chain_exception(code, e, type, msg) { stringstream ss; ss << msg; ss << MONGO_caused_by(e); throw type(ss.str().c_str(), code); }
|
||||
#define m_chain_exception MONGO_chain_exception
|
||||
|
||||
#undef MONGO_NORETURN
|
||||
|
|
|
|||
Loading…
Reference in New Issue