Commit a4aefb4c authored by Sébastien Villemot's avatar Sébastien Villemot

Mark all constructors taking a single argument as "explicit"

For a rationale, see http://www.sjbrown.co.uk/2004/05/01/always-use-explicit/
parent ec872e63
......@@ -308,7 +308,7 @@ class TagWithoutArgument
protected:
uint8_t op_code;
public:
inline
inline explicit
TagWithoutArgument(uint8_t op_code_arg) : op_code(op_code_arg)
{
};
......@@ -327,7 +327,7 @@ protected:
uint8_t op_code;
T1 arg1;
public:
inline
inline explicit
TagWithOneArgument(uint8_t op_code_arg) : op_code(op_code_arg)
{
};
......@@ -351,7 +351,7 @@ protected:
T1 arg1;
T2 arg2;
public:
inline
inline explicit
TagWithTwoArguments(uint8_t op_code_arg) : op_code(op_code_arg)
{
};
......@@ -376,7 +376,7 @@ protected:
T2 arg2;
T3 arg3;
public:
inline
inline explicit
TagWithThreeArguments(uint8_t op_code_arg) : op_code(op_code_arg)
{
};
......@@ -402,7 +402,7 @@ protected:
T3 arg3;
T4 arg4;
public:
inline
inline explicit
TagWithFourArguments(uint8_t op_code_arg) : op_code(op_code_arg)
{
};
......@@ -488,7 +488,7 @@ public:
FDIMT_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FDIMT)
{
};
inline
inline explicit
FDIMT_(unsigned int size_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FDIMT, size_arg)
{
};
......@@ -506,7 +506,7 @@ public:
FDIMST_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FDIMST)
{
};
inline
inline explicit
FDIMST_(const unsigned int size_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FDIMST, size_arg)
{
};
......@@ -524,7 +524,7 @@ public:
FLDC_() : TagWithOneArgument<double>::TagWithOneArgument(FLDC)
{
};
inline
inline explicit
FLDC_(const double value_arg) : TagWithOneArgument<double>::TagWithOneArgument(FLDC, value_arg)
{
};
......@@ -542,7 +542,7 @@ public:
FLDU_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDU)
{
};
inline
inline explicit
FLDU_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDU, pos_arg)
{
};
......@@ -560,7 +560,7 @@ public:
FLDSU_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDSU)
{
};
inline
inline explicit
FLDSU_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDSU, pos_arg)
{
};
......@@ -578,7 +578,7 @@ public:
FLDR_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDR)
{
};
inline
inline explicit
FLDR_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDR, pos_arg)
{
};
......@@ -596,7 +596,7 @@ public:
FLDT_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDT)
{
};
inline
inline explicit
FLDT_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDT, pos_arg)
{
};
......@@ -614,7 +614,7 @@ public:
FLDST_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDST)
{
};
inline
inline explicit
FLDST_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDST, pos_arg)
{
};
......@@ -632,7 +632,7 @@ public:
FSTPT_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPT)
{
};
inline
inline explicit
FSTPT_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPT, pos_arg)
{
};
......@@ -650,7 +650,7 @@ public:
FSTPST_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPST)
{
};
inline
inline explicit
FSTPST_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPST, pos_arg)
{
};
......@@ -668,7 +668,7 @@ public:
FSTPR_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPR)
{
};
inline
inline explicit
FSTPR_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPR, pos_arg)
{
};
......@@ -686,7 +686,7 @@ public:
FSTPU_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPU)
{
};
inline
inline explicit
FSTPU_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPU, pos_arg)
{
};
......@@ -704,7 +704,7 @@ public:
FSTPSU_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPSU)
{
};
inline
inline explicit
FSTPSU_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPSU, pos_arg)
{
};
......@@ -722,7 +722,7 @@ public:
FSTPG_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPG, 0)
{
};
inline
inline explicit
FSTPG_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPG, pos_arg)
{
};
......@@ -796,7 +796,7 @@ public:
FUNARY_() : TagWithOneArgument<uint8_t>::TagWithOneArgument(FUNARY)
{
};
inline
inline explicit
FUNARY_(uint8_t op_type_arg) : TagWithOneArgument<uint8_t>::TagWithOneArgument(FUNARY, op_type_arg)
{
};
......@@ -814,7 +814,7 @@ public:
FBINARY_() : TagWithOneArgument<uint8_t>::TagWithOneArgument(FBINARY)
{
};
inline
inline explicit
FBINARY_(const int op_type_arg) : TagWithOneArgument<uint8_t>::TagWithOneArgument(FBINARY, op_type_arg)
{
};
......@@ -832,7 +832,7 @@ public:
FTRINARY_() : TagWithOneArgument<uint8_t>::TagWithOneArgument(FTRINARY)
{
};
inline
inline explicit
FTRINARY_(const int op_type_arg) : TagWithOneArgument<uint8_t>::TagWithOneArgument(FTRINARY, op_type_arg)
{
};
......@@ -850,7 +850,7 @@ public:
FOK_() : TagWithOneArgument<int>::TagWithOneArgument(FOK)
{
};
inline
inline explicit
FOK_(const int arg_arg) : TagWithOneArgument<int>::TagWithOneArgument(FOK, arg_arg)
{
};
......@@ -868,7 +868,7 @@ public:
FJMPIFEVAL_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FJMPIFEVAL)
{
};
inline
inline explicit
FJMPIFEVAL_(unsigned int arg_pos) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FJMPIFEVAL, arg_pos)
{
};
......@@ -886,7 +886,7 @@ public:
FJMP_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FJMP)
{
};
inline
inline explicit
FJMP_(unsigned int arg_pos) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FJMP, arg_pos)
{
};
......@@ -904,7 +904,7 @@ public:
FLDTEF_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDTEF)
{
};
inline
inline explicit
FLDTEF_(unsigned int number) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDTEF, number)
{
};
......@@ -922,7 +922,7 @@ public:
FSTPTEF_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPTEF)
{
};
inline
inline explicit
FSTPTEF_(unsigned int number) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPTEF, number)
{
};
......
This diff is collapsed.
......@@ -86,7 +86,7 @@ class Cluster
{
friend class ConfigFile;
public:
Cluster(member_nodes_t member_nodes_arg);
explicit Cluster(member_nodes_t member_nodes_arg);
protected:
member_nodes_t member_nodes;
......
......@@ -131,7 +131,7 @@ public:
{
public:
string name;
LocalVariableException(string name_arg) : name(move(name_arg))
explicit LocalVariableException(string name_arg) : name(move(name_arg))
{
}
};
......@@ -279,7 +279,7 @@ public:
{
public:
string name;
TrendException(string name_arg) : name(move(name_arg))
explicit TrendException(string name_arg) : name(move(name_arg))
{
}
};
......@@ -306,7 +306,7 @@ public:
public:
//! Symbol ID
int id;
UnknownLocalVariableException(int id_arg) : id(id_arg)
explicit UnknownLocalVariableException(int id_arg) : id(id_arg)
{
}
};
......
......@@ -37,7 +37,7 @@ public:
public:
//! Symbol ID
int id;
UnknownExternalFunctionSymbolIDException(int id_arg) : id(id_arg)
explicit UnknownExternalFunctionSymbolIDException(int id_arg) : id(id_arg)
{
}
};
......
......@@ -44,7 +44,7 @@ using namespace std;
class ModFile
{
public:
ModFile(WarningConsolidation &warnings_arg);
explicit ModFile(WarningConsolidation &warnings_arg);
//! Symbol table
SymbolTable symbol_table;
//! External Functions table
......
......@@ -129,7 +129,7 @@ class InitvalFileStatement : public Statement
private:
const string filename;
public:
InitvalFileStatement(string filename_arg);
explicit InitvalFileStatement(string filename_arg);
void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
void writeJsonOutput(ostream &output) const override;
};
......@@ -139,7 +139,7 @@ class HistvalFileStatement : public Statement
private:
const string filename;
public:
HistvalFileStatement(string filename_arg);
explicit HistvalFileStatement(string filename_arg);
void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
void writeJsonOutput(ostream &output) const override;
};
......@@ -165,7 +165,7 @@ class SaveParamsAndSteadyStateStatement : public Statement
private:
const string filename;
public:
SaveParamsAndSteadyStateStatement(string filename_arg);
explicit SaveParamsAndSteadyStateStatement(string filename_arg);
void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
void writeJsonOutput(ostream &output) const override;
};
......
......@@ -56,7 +56,7 @@ private:
static MatrixForm determineMatrixForm(const matrix_t &matrix) noexcept(false);
public:
SigmaeStatement(matrix_t matrix_arg) noexcept(false);
explicit SigmaeStatement(matrix_t matrix_arg) noexcept(false);
void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
};
......
......@@ -157,7 +157,7 @@ class NativeStatement : public Statement
private:
const string native_statement;
public:
NativeStatement(string native_statement_arg);
explicit NativeStatement(string native_statement_arg);
void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
void writeJsonOutput(ostream &output) const override;
};
......@@ -167,7 +167,7 @@ class VerbatimStatement : public Statement
private:
const string verbatim_statement;
public:
VerbatimStatement(string verbatim_statement_arg);
explicit VerbatimStatement(string verbatim_statement_arg);
void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
void writeJsonOutput(ostream &output) const override;
};
......
......@@ -48,7 +48,7 @@ private:
map<string, map<tuple<int, int, int>, expr_t>> AR; // AR: name -> (eqn, lag, lhs_symb_id) -> expr_t
map<string, map<tuple<int, int, int>, expr_t>> EC; // EC: name -> (eqn, lag, col) -> expr_t
public:
TrendComponentModelTable(SymbolTable &symbol_table_arg);
explicit TrendComponentModelTable(SymbolTable &symbol_table_arg);
//! Add a trend component model
void addTrendComponentModel(string name_arg, vector<string> eqtags_arg,
......@@ -124,7 +124,7 @@ private:
map<string, vector<expr_t>> lhs_expr_t;
map<string, map<tuple<int, int, int>, expr_t>> AR; // AR: name -> (eqn, lag, lhs_symb_id) -> param_expr_t
public:
VarModelTable(SymbolTable &symbol_table_arg);
explicit VarModelTable(SymbolTable &symbol_table_arg);
//! Add a VAR model
void addVarModel(string name, vector<string> eqtags,
......
......@@ -167,7 +167,7 @@ public:
public:
//! Symbol name
string name;
UnknownSymbolNameException(string name_arg) : name(move(name_arg))
explicit UnknownSymbolNameException(string name_arg) : name(move(name_arg))
{
}
};
......@@ -177,7 +177,7 @@ public:
public:
//! Symbol ID
int id;
UnknownSymbolIDException(int id_arg) : id(id_arg)
explicit UnknownSymbolIDException(int id_arg) : id(id_arg)
{
}
};
......@@ -220,7 +220,7 @@ public:
orig_lead_lag(orig_lead_lag_arg)
{
}
SearchFailedException(int symb_id_arg) : symb_id(symb_id_arg)
explicit SearchFailedException(int symb_id_arg) : symb_id(symb_id_arg)
{
}
};
......
......@@ -34,7 +34,7 @@ private:
bool no_warn;
public:
WarningConsolidation(bool no_warn_arg) : no_warn(no_warn_arg)
explicit WarningConsolidation(bool no_warn_arg) : no_warn(no_warn_arg)
{
};
~WarningConsolidation()
......
......@@ -208,7 +208,7 @@ public:
{
public:
const string name;
UnknownVariable(string name_arg) : name(move(name_arg))
explicit UnknownVariable(string name_arg) : name(move(name_arg))
{
}
};
......
......@@ -46,7 +46,7 @@ public:
{
public:
const string message;
TypeError(string message_arg) : message{move(message_arg)}
explicit TypeError(string message_arg) : message{move(message_arg)}
{
};
};
......@@ -117,7 +117,7 @@ public:
class IntMV : public MacroValue
{
public:
IntMV(int value_arg);
explicit IntMV(int value_arg);
//! Underlying integer value
const int value;
......@@ -155,7 +155,7 @@ public:
class StringMV : public MacroValue
{
public:
StringMV(string value_arg);
explicit StringMV(string value_arg);
//! Underlying string value
const string value;
......@@ -188,7 +188,7 @@ public:
class ArrayMV : public MacroValue
{
public:
ArrayMV(vector<MacroValuePtr> values_arg);
explicit ArrayMV(vector<MacroValuePtr> values_arg);
//! Underlying vector
const vector<MacroValuePtr> values;
......@@ -229,7 +229,7 @@ public:
class TupleMV : public MacroValue
{
public:
TupleMV(vector<MacroValuePtr> values_arg);
explicit TupleMV(vector<MacroValuePtr> values_arg);
//! Underlying vector
const vector<MacroValuePtr> values;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment