From c4c14963a1d66009fcf04fbc63fdffff4384d9fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Tue, 21 Nov 2023 12:44:44 +0100 Subject: [PATCH] Add clang-format config file for formatting C++ code --- .clang-format | 18 ++++++++++++++++++ meson.build | 1 + 2 files changed, 19 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..87a2c3a9 --- /dev/null +++ b/.clang-format @@ -0,0 +1,18 @@ +# This file should be kept in sync with the one in dynare.git (which also +# contains more explanations). +Language: Cpp +Standard: c++20 +ColumnLimit: 100 +BasedOnStyle: GNU +AllowShortFunctionsOnASingleLine: InlineOnly +AlwaysBreakTemplateDeclarations: Yes +BreakConstructorInitializers: AfterColon +BreakInheritanceList: AfterColon +Cpp11BracedListStyle: true +DeriveLineEnding: false +IndentPPDirectives: AfterHash +PPIndentWidth: 1 +PointerAlignment: Left +SpaceAfterTemplateKeyword: false +SpaceBeforeParens: ControlStatements +SpaceBeforeCpp11BracedList: true diff --git a/meson.build b/meson.build index 22346a6b..4ee79d0e 100644 --- a/meson.build +++ b/meson.build @@ -3,6 +3,7 @@ project('dynare-preprocessor', 'cpp', version : '6-unstable', + # NB: update C++ standard in .clang-format whenever the following is modified default_options : [ 'cpp_std=gnu++20', 'warning_level=2' ], meson_version : '>=0.64.0') -- GitLab