Ensure single-argument constructors are explicit

This commit is contained in:
Richard Quirk 2011-10-28 22:10:19 +02:00
parent 2ca932a3ae
commit a0a5b36667
6 changed files with 6 additions and 6 deletions

View File

@ -38,7 +38,7 @@
class Check {
public:
/** This constructor is used when registering the CheckClass */
Check(const std::string &aname);
explicit Check(const std::string &aname);
/** This constructor is used when running checks. */
Check(const std::string &aname, const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)

View File

@ -191,7 +191,7 @@ public:
/**
* @param str Token::str() is compared against this.
*/
TokenStrEquals(const std::string &str)
explicit TokenStrEquals(const std::string &str)
: value(str) {
}

View File

@ -940,7 +940,7 @@ void CheckNullPointer::nullConstantDereference()
class Nullpointer : public ExecutionPath {
public:
/** Startup constructor */
Nullpointer(Check *c) : ExecutionPath(c, 0), null(false) {
explicit Nullpointer(Check *c) : ExecutionPath(c, 0), null(false) {
}
private:

View File

@ -41,7 +41,7 @@ namespace {
class UninitVar : public ExecutionPath {
public:
/** Startup constructor */
UninitVar(Check *c)
explicit UninitVar(Check *c)
: ExecutionPath(c, 0), pointer(false), array(false), alloc(false), strncpy_(false), memset_nonzero(false) {
}

View File

@ -2167,7 +2167,7 @@ public:
* @param macro The code after define, until end of line,
* e.g. "A(x) foo(x);"
*/
PreprocessorMacro(const std::string &macro)
explicit PreprocessorMacro(const std::string &macro)
: _macro(macro), _prefix("__cppcheck__") {
tokenizer.setSettings(&settings);

View File

@ -43,7 +43,7 @@ private:
Token();
public:
Token(Token **tokensBack);
explicit Token(Token **tokensBack);
~Token();
void str(const std::string &s);