From 56e2148930b6cfc41090edc41ba3e18ed68e76be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Wed, 20 Nov 2024 14:17:20 +0100 Subject: [PATCH] Bump to clang-format 16 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit – enable new options InsertNewlineAtEOF and RemoveSemicolon – reformat the code accordingly --- .clang-format | 2 ++ src/ComputingTasks.hh | 6 +++--- src/Configuration.hh | 2 +- src/DynamicModel.hh | 2 +- src/ExprNode.hh | 2 +- src/ModelTree.hh | 18 +++++++++--------- src/Statement.hh | 3 ++- src/SymbolList.hh | 2 +- src/SymbolTable.hh | 2 +- src/WarningConsolidation.hh | 2 +- 10 files changed, 22 insertions(+), 19 deletions(-) diff --git a/.clang-format b/.clang-format index cd9c21f5..21875122 100644 --- a/.clang-format +++ b/.clang-format @@ -11,9 +11,11 @@ BreakInheritanceList: AfterColon Cpp11BracedListStyle: true DeriveLineEnding: false IndentPPDirectives: AfterHash +InsertNewlineAtEOF: true PackConstructorInitializers: NextLine PPIndentWidth: 1 PointerAlignment: Left +RemoveSemicolon: true SpaceAfterTemplateKeyword: false SpaceBeforeParens: ControlStatements SpaceBeforeCpp11BracedList: true diff --git a/src/ComputingTasks.hh b/src/ComputingTasks.hh index 2e4df64a..fb1e2bd2 100644 --- a/src/ComputingTasks.hh +++ b/src/ComputingTasks.hh @@ -524,7 +524,7 @@ public: blockName() const override { return "estimated_params"; - }; + } void checkPass(ModFileStructure& mod_file_struct, WarningConsolidation& warnings) override; void writeOutput(ostream& output, const string& basename, bool minimal_workspace) const override; void writeJsonOutput(ostream& output) const override; @@ -542,7 +542,7 @@ public: blockName() const override { return "estimated_params_init"; - }; + } void checkPass(ModFileStructure& mod_file_struct, WarningConsolidation& warnings) override; void writeOutput(ostream& output, const string& basename, bool minimal_workspace) const override; void writeJsonOutput(ostream& output) const override; @@ -557,7 +557,7 @@ public: blockName() const override { return "estimated_params_bounds"; - }; + } void checkPass(ModFileStructure& mod_file_struct, WarningConsolidation& warnings) override; void writeOutput(ostream& output, const string& basename, bool minimal_workspace) const override; void writeJsonOutput(ostream& output) const override; diff --git a/src/Configuration.hh b/src/Configuration.hh index 2e13fe76..1fd2cd06 100644 --- a/src/Configuration.hh +++ b/src/Configuration.hh @@ -47,7 +47,7 @@ private: get_paths() const { return paths; - }; + } private: map<string, vector<string>> paths; diff --git a/src/DynamicModel.hh b/src/DynamicModel.hh index 2cbcc2cf..5d3f3883 100644 --- a/src/DynamicModel.hh +++ b/src/DynamicModel.hh @@ -713,7 +713,7 @@ public: { return tuple {static_only_equations, static_only_equations_lineno, static_only_complementarity_conditions, static_only_equations_equation_tags}; - }; + } //! Returns true if a parameter was used in the model block with a lead or lag bool ParamUsedWithLeadLag() const; diff --git a/src/ExprNode.hh b/src/ExprNode.hh index dfdb04bb..c9978874 100644 --- a/src/ExprNode.hh +++ b/src/ExprNode.hh @@ -283,7 +283,7 @@ protected: min_cost(bool is_matlab) { return is_matlab ? min_cost_matlab : min_cost_c; - }; + } //! Initializes data member non_null_derivatives virtual void prepareForDerivation() = 0; diff --git a/src/ModelTree.hh b/src/ModelTree.hh index 4198c299..97363ff9 100644 --- a/src/ModelTree.hh +++ b/src/ModelTree.hh @@ -211,7 +211,7 @@ protected: getRecursiveSize() const { return size - mfs_size; - }; + } }; // Whether block decomposition has been successfully computed @@ -559,7 +559,7 @@ protected: { return equation_type_and_normalized_equation[eq_idx_block2orig[blocks[blk].first_equation + eq]] .first; - }; + } //! Return true if the equation has been normalized bool isBlockEquationRenormalized(int blk, int eq) const @@ -567,44 +567,44 @@ protected: return equation_type_and_normalized_equation[eq_idx_block2orig[blocks[blk].first_equation + eq]] .first == EquationType::evaluateRenormalized; - }; + } //! Return the expr_t of equation belonging to the block BinaryOpNode* getBlockEquationExpr(int blk, int eq) const { return equations[eq_idx_block2orig[blocks[blk].first_equation + eq]]; - }; + } //! Return the expr_t of renormalized equation belonging to the block BinaryOpNode* getBlockEquationRenormalizedExpr(int blk, int eq) const { return equation_type_and_normalized_equation[eq_idx_block2orig[blocks[blk].first_equation + eq]] .second; - }; + } //! Return the original number of equation belonging to the block int getBlockEquationID(int blk, int eq) const { return eq_idx_block2orig[blocks[blk].first_equation + eq]; - }; + } //! Return the original number of variable belonging to the block int getBlockVariableID(int blk, int var) const { return endo_idx_block2orig[blocks[blk].first_equation + var]; - }; + } //! Return the position of an equation (given by its original index) inside its block int getBlockInitialEquationID(int blk, int eq) const { return eq_idx_orig2block[eq] - blocks[blk].first_equation; - }; + } //! Return the position of a variable (given by its original index) inside its block int getBlockInitialVariableID(int blk, int var) const { return endo_idx_orig2block[var] - blocks[blk].first_equation; - }; + } //! Initialize equation_reordered & variable_reordered void initializeVariablesAndEquations(); diff --git a/src/Statement.hh b/src/Statement.hh index e67525cb..e542e799 100644 --- a/src/Statement.hh +++ b/src/Statement.hh @@ -315,7 +315,8 @@ public: /* Applies a variant visitor to the value of the option with that name. Throws UnknownOptionException if there is no option with that name. */ template<class Visitor> - requires invocable<Visitor, OptionValue> decltype(auto) + requires invocable<Visitor, OptionValue> + decltype(auto) visit(const string& name, Visitor&& vis) const { auto it = options.find(name); diff --git a/src/SymbolList.hh b/src/SymbolList.hh index 9c96beb0..5cf58eb1 100644 --- a/src/SymbolList.hh +++ b/src/SymbolList.hh @@ -63,7 +63,7 @@ public: empty() const { return symbols.empty(); - }; + } //! Return the list of symbols [[nodiscard]] vector<string> getSymbols() const; }; diff --git a/src/SymbolTable.hh b/src/SymbolTable.hh index 3a3a1a3e..14eb6ca5 100644 --- a/src/SymbolTable.hh +++ b/src/SymbolTable.hh @@ -352,7 +352,7 @@ public: AuxVarsSize() const { return aux_vars.size(); - }; + } //! Tests if symbol already exists [[nodiscard]] inline bool exists(const string& name) const; //! Get symbol name (by ID) diff --git a/src/WarningConsolidation.hh b/src/WarningConsolidation.hh index 1285ffdb..c806bb41 100644 --- a/src/WarningConsolidation.hh +++ b/src/WarningConsolidation.hh @@ -62,7 +62,7 @@ public: numWarnings() const { return num_warnings; - }; + } }; WarningConsolidation& -- GitLab