From decd2c74f105a11a21de08097649f9bc102a1b5c Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Sun, 15 Sep 2019 23:56:17 +0200 Subject: [PATCH] Mark constructors with only one parameter as explicit Spotted by cppcheck --- src/mathed/InsetMath.h | 2 +- src/mathed/InsetMathBox.h | 4 ++-- src/mathed/InsetMathBrace.h | 4 ++-- src/mathed/InsetMathComment.h | 6 +++--- src/mathed/InsetMathDiagram.h | 2 +- src/mathed/InsetMathDiff.h | 2 +- src/mathed/InsetMathEnsureMath.h | 2 +- src/mathed/InsetMathGrid.h | 2 +- src/mathed/InsetMathHull.h | 2 +- src/mathed/InsetMathLefteqn.h | 2 +- src/mathed/InsetMathMacroArgument.h | 2 +- src/mathed/InsetMathMacroTemplate.cpp | 4 ++-- src/mathed/InsetMathMacroTemplate.h | 2 +- src/mathed/InsetMathOverset.h | 2 +- src/mathed/InsetMathPar.h | 2 +- src/mathed/InsetMathRef.h | 2 +- src/mathed/InsetMathRoot.h | 2 +- src/mathed/InsetMathScript.h | 2 +- src/mathed/InsetMathSqrt.h | 2 +- src/mathed/InsetMathSubstack.h | 2 +- src/mathed/InsetMathUnderset.h | 2 +- src/mathed/MacroTable.h | 2 +- src/mathed/MathCompletionList.h | 2 +- src/mathed/MathData.h | 2 +- src/mathed/MathStream.h | 2 +- 25 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/mathed/InsetMath.h b/src/mathed/InsetMath.h index 32f265950c..421cd162b9 100644 --- a/src/mathed/InsetMath.h +++ b/src/mathed/InsetMath.h @@ -102,7 +102,7 @@ typedef void const * uid_type; class InsetMath : public Inset { public: /// - InsetMath(Buffer * buf = 0) : Inset(buf) {} + explicit InsetMath(Buffer * buf = 0) : Inset(buf) {} /// identification as math inset InsetMath * asInsetMath() { return this; } /// identification as math inset diff --git a/src/mathed/InsetMathBox.h b/src/mathed/InsetMathBox.h index af166c19c7..e07fed9c48 100644 --- a/src/mathed/InsetMathBox.h +++ b/src/mathed/InsetMathBox.h @@ -54,7 +54,7 @@ private: class InsetMathFBox : public InsetMathNest { public: /// - InsetMathFBox(Buffer * buf); + explicit InsetMathFBox(Buffer * buf); /// mode_type currentMode() const { return TEXT_MODE; } /// @@ -116,7 +116,7 @@ private: class InsetMathBoxed : public InsetMathNest { public: /// - InsetMathBoxed(Buffer * buf); + explicit InsetMathBoxed(Buffer * buf); /// marker_type marker(BufferView const *) const { return NO_MARKER; } /// diff --git a/src/mathed/InsetMathBrace.h b/src/mathed/InsetMathBrace.h index 82393e97fc..4a9efa716a 100644 --- a/src/mathed/InsetMathBrace.h +++ b/src/mathed/InsetMathBrace.h @@ -22,9 +22,9 @@ namespace lyx { class InsetMathBrace : public InsetMathNest { public: /// - InsetMathBrace(Buffer * buf); + explicit InsetMathBrace(Buffer * buf); /// - InsetMathBrace(MathData const & ar); + explicit InsetMathBrace(MathData const & ar); /// identifies brace insets InsetMathBrace * asBraceInset() { return this; } /// identifies brace insets diff --git a/src/mathed/InsetMathComment.h b/src/mathed/InsetMathComment.h index 8cfe1368d7..10b244613f 100644 --- a/src/mathed/InsetMathComment.h +++ b/src/mathed/InsetMathComment.h @@ -23,11 +23,11 @@ class latexkeys; class InsetMathComment : public InsetMathNest { public: /// - InsetMathComment(Buffer * buf); + explicit InsetMathComment(Buffer * buf); /// - InsetMathComment(MathData const & ar); + explicit InsetMathComment(MathData const & ar); /// - explicit InsetMathComment(Buffer * buf, docstring const &); + InsetMathComment(Buffer * buf, docstring const &); /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/InsetMathDiagram.h b/src/mathed/InsetMathDiagram.h index 732cd4ee1b..c7928ef576 100644 --- a/src/mathed/InsetMathDiagram.h +++ b/src/mathed/InsetMathDiagram.h @@ -22,7 +22,7 @@ namespace lyx { class InsetMathDiagram : public InsetMathGrid { public: /// - InsetMathDiagram(Buffer * buf); + explicit InsetMathDiagram(Buffer * buf); /// void metrics(MetricsInfo &, Dimension &) const; /// diff --git a/src/mathed/InsetMathDiff.h b/src/mathed/InsetMathDiff.h index 063e5214cf..f0d16f12bb 100644 --- a/src/mathed/InsetMathDiff.h +++ b/src/mathed/InsetMathDiff.h @@ -24,7 +24,7 @@ namespace lyx { class InsetMathDiff : public InsetMathNest { public: /// - InsetMathDiff(Buffer * buf); + explicit InsetMathDiff(Buffer * buf); /// void addDer(MathData const & der); /// diff --git a/src/mathed/InsetMathEnsureMath.h b/src/mathed/InsetMathEnsureMath.h index 41c3ad654a..45dfa2ba9a 100644 --- a/src/mathed/InsetMathEnsureMath.h +++ b/src/mathed/InsetMathEnsureMath.h @@ -22,7 +22,7 @@ namespace lyx { /// Inset for ensuring math mode class InsetMathEnsureMath : public InsetMathNest { public: - InsetMathEnsureMath(Buffer * buf); + explicit InsetMathEnsureMath(Buffer * buf); /// mode_type currentMode() const { return MATH_MODE; } /// diff --git a/src/mathed/InsetMathGrid.h b/src/mathed/InsetMathGrid.h index a61439cfcd..b6d8044057 100644 --- a/src/mathed/InsetMathGrid.h +++ b/src/mathed/InsetMathGrid.h @@ -96,7 +96,7 @@ public: public: /// sets nrows and ncols to 1, vertical alingment to 'c' - InsetMathGrid(Buffer * buf); + explicit InsetMathGrid(Buffer * buf); /// Note: columns first! InsetMathGrid(Buffer * buf, col_type m, row_type n); /// diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h index a6fc8c9d64..c801a4f936 100644 --- a/src/mathed/InsetMathHull.h +++ b/src/mathed/InsetMathHull.h @@ -41,7 +41,7 @@ public: NOTAG }; /// - InsetMathHull(Buffer * buf); + explicit InsetMathHull(Buffer * buf); /// InsetMathHull(Buffer * buf, HullType type); /// diff --git a/src/mathed/InsetMathLefteqn.h b/src/mathed/InsetMathLefteqn.h index 1adb0bd400..0ad64af111 100644 --- a/src/mathed/InsetMathLefteqn.h +++ b/src/mathed/InsetMathLefteqn.h @@ -23,7 +23,7 @@ namespace lyx { class InsetMathLefteqn : public InsetMathNest { public: /// - InsetMathLefteqn(Buffer * buf); + explicit InsetMathLefteqn(Buffer * buf); /// docstring name() const; /// diff --git a/src/mathed/InsetMathMacroArgument.h b/src/mathed/InsetMathMacroArgument.h index 178c89818d..fe42f2be36 100644 --- a/src/mathed/InsetMathMacroArgument.h +++ b/src/mathed/InsetMathMacroArgument.h @@ -24,7 +24,7 @@ namespace lyx { // A # that failed to parse class InsetMathHash : public InsetMath { public: - InsetMathHash(docstring const & str = docstring()) : str_('#' + str) {}; + explicit InsetMathHash(docstring const & str = docstring()) : str_('#' + str) {}; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/InsetMathMacroTemplate.cpp b/src/mathed/InsetMathMacroTemplate.cpp index c300b2c2f2..dd9bec9acc 100644 --- a/src/mathed/InsetMathMacroTemplate.cpp +++ b/src/mathed/InsetMathMacroTemplate.cpp @@ -250,7 +250,7 @@ void InsetDisplayLabelBox::draw(PainterInfo & pi, int x, int y) const class InsetMathWrapper : public InsetMath { public: /// - InsetMathWrapper(MathData const * value) : value_(value) {} + explicit InsetMathWrapper(MathData const * value) : value_(value) {} /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// @@ -755,7 +755,7 @@ class OptionalsMacroInstanceFix { public: /// - OptionalsMacroInstanceFix(int optionals) : optionals_(optionals) {} + explicit OptionalsMacroInstanceFix(int optionals) : optionals_(optionals) {} /// void operator()(InsetMathMacro * macro) { diff --git a/src/mathed/InsetMathMacroTemplate.h b/src/mathed/InsetMathMacroTemplate.h index ddcfe4df78..978aa64ed7 100644 --- a/src/mathed/InsetMathMacroTemplate.h +++ b/src/mathed/InsetMathMacroTemplate.h @@ -27,7 +27,7 @@ class XHTMLStream; class InsetMathMacroTemplate : public InsetMathNest { public: /// - InsetMathMacroTemplate(Buffer * buf); + explicit InsetMathMacroTemplate(Buffer * buf); /// InsetMathMacroTemplate(Buffer * buf, docstring const & name, int nargs, int optional, MacroType type, diff --git a/src/mathed/InsetMathOverset.h b/src/mathed/InsetMathOverset.h index 213c96f5b3..d7b8353922 100644 --- a/src/mathed/InsetMathOverset.h +++ b/src/mathed/InsetMathOverset.h @@ -22,7 +22,7 @@ namespace lyx { class InsetMathOverset : public InsetMathFracBase { public: /// - InsetMathOverset(Buffer * buf) : InsetMathFracBase(buf) {} + explicit InsetMathOverset(Buffer * buf) : InsetMathFracBase(buf) {} /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/InsetMathPar.h b/src/mathed/InsetMathPar.h index 0a178f4396..5aadfa8b3a 100644 --- a/src/mathed/InsetMathPar.h +++ b/src/mathed/InsetMathPar.h @@ -21,7 +21,7 @@ namespace lyx { class InsetMathPar : public InsetMathHull { public: /// - InsetMathPar(Buffer * buf) : InsetMathHull(buf) {} + explicit InsetMathPar(Buffer * buf) : InsetMathHull(buf) {} /// InsetMathPar(Buffer * buf, MathData const & ar); /// diff --git a/src/mathed/InsetMathRef.h b/src/mathed/InsetMathRef.h index d1046d9aba..204e9c4746 100644 --- a/src/mathed/InsetMathRef.h +++ b/src/mathed/InsetMathRef.h @@ -23,7 +23,7 @@ class Buffer; class InsetMathRef : public InsetMathCommand { public: /// - InsetMathRef(Buffer * buf); + explicit InsetMathRef(Buffer * buf); /// explicit InsetMathRef(Buffer * buf, docstring const & data); /// diff --git a/src/mathed/InsetMathRoot.h b/src/mathed/InsetMathRoot.h index 088be24c05..144ecdf7a6 100644 --- a/src/mathed/InsetMathRoot.h +++ b/src/mathed/InsetMathRoot.h @@ -23,7 +23,7 @@ namespace lyx { class InsetMathRoot : public InsetMathNest { public: /// - InsetMathRoot(Buffer * buf); + explicit InsetMathRoot(Buffer * buf); /// bool idxUpDown(Cursor & cur, bool up) const; /// diff --git a/src/mathed/InsetMathScript.h b/src/mathed/InsetMathScript.h index d29ffbd50b..7d7d852fb1 100644 --- a/src/mathed/InsetMathScript.h +++ b/src/mathed/InsetMathScript.h @@ -25,7 +25,7 @@ namespace lyx { class InsetMathScript : public InsetMathNest { public: /// create inset without scripts - InsetMathScript(Buffer * buf); + explicit InsetMathScript(Buffer * buf); /// create inset with single script explicit InsetMathScript(Buffer * buf, bool up); /// create inset with single script and given nucleus diff --git a/src/mathed/InsetMathSqrt.h b/src/mathed/InsetMathSqrt.h index d2aab3282b..8a9a6fc455 100644 --- a/src/mathed/InsetMathSqrt.h +++ b/src/mathed/InsetMathSqrt.h @@ -23,7 +23,7 @@ namespace lyx { class InsetMathSqrt : public InsetMathNest { public: /// - InsetMathSqrt(Buffer * buf); + explicit InsetMathSqrt(Buffer * buf); /// void draw(PainterInfo &, int x, int y) const; /// diff --git a/src/mathed/InsetMathSubstack.h b/src/mathed/InsetMathSubstack.h index 822b0aa453..bb3089b61a 100644 --- a/src/mathed/InsetMathSubstack.h +++ b/src/mathed/InsetMathSubstack.h @@ -23,7 +23,7 @@ namespace lyx { class InsetMathSubstack : public InsetMathGrid { public: /// - InsetMathSubstack(Buffer * buf); + explicit InsetMathSubstack(Buffer * buf); /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/InsetMathUnderset.h b/src/mathed/InsetMathUnderset.h index 50143ae4d5..565f0d5cc4 100644 --- a/src/mathed/InsetMathUnderset.h +++ b/src/mathed/InsetMathUnderset.h @@ -22,7 +22,7 @@ namespace lyx { class InsetMathUnderset : public InsetMathFracBase { public: /// - InsetMathUnderset(Buffer * buf) : InsetMathFracBase(buf) {} + explicit InsetMathUnderset(Buffer * buf) : InsetMathFracBase(buf) {} /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// diff --git a/src/mathed/MacroTable.h b/src/mathed/MacroTable.h index eb613cae07..d31d04b35b 100644 --- a/src/mathed/MacroTable.h +++ b/src/mathed/MacroTable.h @@ -39,7 +39,7 @@ enum MacroType { class MacroData { public: /// Constructor to make STL containers happy - MacroData(Buffer * buf = 0); + explicit MacroData(Buffer * buf = 0); /// Create lazy MacroData which only queries the macro template when needed MacroData(Buffer * buf, DocIterator const & pos); /// Create non-lazy MacroData which directly queries the macro template diff --git a/src/mathed/MathCompletionList.h b/src/mathed/MathCompletionList.h index 7d36557fcb..5131f87e1f 100644 --- a/src/mathed/MathCompletionList.h +++ b/src/mathed/MathCompletionList.h @@ -24,7 +24,7 @@ namespace lyx { class MathCompletionList : public CompletionList { public: /// - MathCompletionList(Cursor const & cur); + explicit MathCompletionList(Cursor const & cur); /// virtual ~MathCompletionList(); diff --git a/src/mathed/MathData.h b/src/mathed/MathData.h index 810223d5be..3c93421821 100644 --- a/src/mathed/MathData.h +++ b/src/mathed/MathData.h @@ -68,7 +68,7 @@ public: public: /// - MathData(Buffer * buf = 0) : minasc_(0), mindes_(0), slevel_(0), + explicit MathData(Buffer * buf = 0) : minasc_(0), mindes_(0), slevel_(0), sshift_(0), buffer_(buf) {} /// MathData(Buffer * buf, const_iterator from, const_iterator to); diff --git a/src/mathed/MathStream.h b/src/mathed/MathStream.h index 7779921577..df9d61088f 100644 --- a/src/mathed/MathStream.h +++ b/src/mathed/MathStream.h @@ -307,7 +307,7 @@ public: class ETag { public: /// - ETag(char const * const tag) : tag_(tag) {} + explicit ETag(char const * const tag) : tag_(tag) {} /// char const * const tag_; }; -- 2.39.2