Ensure single-argument constructors are explicit
This commit is contained in:
parent
2ca932a3ae
commit
a0a5b36667
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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) {
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ¯o)
|
||||
explicit PreprocessorMacro(const std::string ¯o)
|
||||
: _macro(macro), _prefix("__cppcheck__") {
|
||||
tokenizer.setSettings(&settings);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ private:
|
|||
Token();
|
||||
|
||||
public:
|
||||
Token(Token **tokensBack);
|
||||
explicit Token(Token **tokensBack);
|
||||
~Token();
|
||||
|
||||
void str(const std::string &s);
|
||||
|
|
Loading…
Reference in New Issue