Commit Graph

40 Commits (master)

Author SHA1 Message Date
Sébastien Villemot 7cfe226e58
When possible, use a more efficient overload of std::string::find()
Automatically detected by clang-tidy using the performance-faster-string-find
check.
2023-12-13 14:21:11 +01:00
Sébastien Villemot bffd68e0bf
Add a clang-tidy configuration file
Also add some annotations to remove some false positives.

There remain some boost-related false positives, it’s unclear how to suppress
them.
2023-12-04 16:37:00 +01:00
Sébastien Villemot d463607e90
Reformat C++ source code using clang-format 15 2023-11-30 15:58:32 +01:00
Sébastien Villemot a5eac0260a
JSON: fix output of date options
They were not enclosed within quotes.

Ref. dynare#1875
2022-12-14 12:16:04 +01:00
Sébastien Villemot 7f1b4fcc20
Refactor OptionsList class
In particular, use a std::variant to store the values of options. This ensures
that a given option name can have only one value (previously, for a given
option name, it was possible to store several values as long as they were of
different types).
2022-09-20 11:56:43 +02:00
Sébastien Villemot c3fc5b1dd7
Enable -Wunused-parameter
As a consequence, add many [[maybe_unused]] attributes for legitimate
cases (mainly in virtual functions).
2022-06-24 17:11:48 +02:00
Sébastien Villemot c94dfb848c
C++20 modernization: use initialization within range-based for loop
In particular, use this feature in many loops which feature a special treatment
for the first iteration, using a boolean variable (replacing iterator
manipulation). By the way, also use std::exchange() to simultaneously test the
value of this variable and update it.
2022-06-07 14:35:59 +02:00
Sébastien Villemot 3516894a71
JSON output: fix handling of vector value options
The vectors were previously stored as strings internally, which would not
necessarily contain the commas which are required in JSON (but not in
MATLAB/Octave). The fix consists in internally storing those options as
std::vector.

Closes: #96
2022-05-18 17:44:36 +02:00
Sébastien Villemot 5b50c10229
Simplify OptionsList::writeJsonOutput() 2022-05-18 16:33:49 +02:00
Sébastien Villemot 29c683c6ad
JSON output: add missing comma for paired numerical options 2022-05-18 16:33:49 +02:00
Sébastien Villemot d64682f346
JSON output: fix possible spurious commas in vector of int or string options 2022-05-18 16:33:49 +02:00
Sébastien Villemot ae97c4eb29
Factorization in OptionsList class 2022-05-17 18:08:10 +02:00
Sébastien Villemot 74ef3457b4
Use secure URL for link to GNU licenses 2021-06-09 17:21:00 +02:00
Sébastien Villemot 86b2b4c2da
When order option > 3, compute planner objective derivatives at that order
Ref. dynare!1866
2021-06-04 16:20:29 +02:00
Sébastien Villemot c2d47fb48e
Julia: remove driver file
The Julia code now uses the JSON output for retrieving the information that
previously was in the driver file.
2021-04-19 17:02:41 +02:00
Michel Juillard 50a2e7c44f
Add escape codes in NativeStatement and VerbatimStatement writeJsonOutput() method 2021-04-01 17:05:10 +02:00
Stéphane Adjemian (Charybdis) f0d67b01dd
Honour bi-annual dates in mod file. 2021-02-26 09:30:02 +01:00
Sébastien Villemot 638b4c7ac5
Ensure that all statements produce an output in JSON mode 2020-11-26 16:25:22 +01:00
Johannes Pfeifer 98ddbb61ba Method of moments: Preprocessor preparations 2020-07-10 11:18:57 +02:00
Houtan Bastani a3fb2b123e
fix bug introduced in a778ba4 2020-02-18 12:32:34 +01:00
Houtan Bastani a778ba4ab4
fix lookbehind to handle `-` sign in substitution of dates in native statements
closes dynare#1708
2020-02-17 17:37:58 +01:00
Houtan Bastani 976e2ae17a
remove support for weekly dates 2020-02-17 15:03:26 +01:00
Sébastien Villemot e2d5a83592
Global reindentation 2019-12-20 16:59:30 +01:00
Sébastien Villemot 031c0cff5f
Various code simplifications and modernizations 2019-12-16 19:42:59 +01:00
Sébastien Villemot d839aea08b
Drop unused functions for writing C and C++ output
These functions should have been deleted in
946d105c04.
2019-10-24 10:54:46 +02:00
Houtan Bastani 21fe0f4bdc
avoid cast warnings when compiling boost headers 2019-04-23 14:57:03 +02:00
Sébastien Villemot b73d554ad2
Use Unicode copyright symbol (in UTF-8 encoding) 2019-04-16 11:35:31 +02:00
Sébastien Villemot 8a41a75c85
Apply modernize-raw-string-literal from clang-tidy
Use ReplaceShorterLiterals option to enforce replacement of all strings.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-raw-string-literal.html
2019-04-03 16:45:52 +02:00
Houtan Bastani 92ada8e7e9
fix bug in writing of JSON output in options list 2019-03-29 17:30:39 +01:00
Sébastien Villemot 1793078ba2
Minor stylistic improvements 2019-03-18 18:49:55 +01:00
Sébastien Villemot e7c9c26d2d
More modernizations with clang-tidy 2019-01-15 11:08:47 +01:00
Sébastien Villemot 1089a223c4 Clean up default constructors/destructors 2018-10-11 17:08:44 +02:00
Sébastien Villemot 7bb5382428 Always use brace-initializer in constructors
The syntax makes clearer the distinction between a function call and an
initialization. Also, it prevents bugs due to implicit type conversions.
2018-10-04 17:19:18 +02:00
Sébastien Villemot 64eb494298 Port to C++11 syntax for default constructors
Performed using modernize-use-equals-default from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-equals-default.html
2018-06-04 15:03:31 +02:00
Sébastien Villemot a185ecf752 Port to C++11 default members initializers
Performed using modernize-use-default-member-init from clang-tidy.

Manual intervention was needed to remove spurious remaining commas.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-default-member-init.html
2018-06-04 15:03:31 +02:00
Sébastien Villemot c0ed97d247 Port to C++11 auto keyword
Performed using modernize-use-auto from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.html
2018-06-04 15:03:26 +02:00
Sébastien Villemot 20bbbd46c3 Port some constructors to pass-by-value using C++11 move semantics
Performed using modernize-pass-by-value from clang-tidy.

Manual intervention was needed to fix an issue in MacroValue.hh.
Also replace std::move by move, since we import the std namespace.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-pass-by-value.html
2018-06-04 12:35:28 +02:00
Sébastien Villemot 6cf4e6dc0c Port to C++11 range-based for loops
Performed using modernize-loop-convert from clang-tidy.

Manual intervention was needed in MacroValue.cc because of a variable name
capture issue.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-loop-convert.html
2018-06-04 12:26:16 +02:00
Houtan Bastani a1437ac982 Merge remote-tracking branch 'dynare-preprocessor-github/master' into other-master 2018-02-26 12:09:58 +01:00
Houtan Bastani b504f160ca move files to src directory 2018-02-15 11:48:04 +01:00