From 864ccd91650e91d34f1c5eecfcf8e8a91f242d58 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 29 Oct 2023 17:11:25 +0100 Subject: [PATCH] updates submodules --- .clang-format | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++ .cproject | 8 +++-- CMakeLists.txt | 43 ++++++++++++++++++++++ dbt-rise-core | 2 +- dbt-rise-tgc | 2 +- scc | 2 +- 6 files changed, 147 insertions(+), 6 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..a2683b8 --- /dev/null +++ b/.clang-format @@ -0,0 +1,96 @@ +Language: Cpp +# BasedOnStyle: LLVM +# should be in line with IndentWidth +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlinesLeft: false +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: false +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: true +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 140 +CommentPragmas: '^( IWYU pragma:| @suppress)' +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 0 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + - Regex: '^(<|"(gtest|isl|json)/)' + Priority: 3 + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '$' +IndentCaseLabels: false +IndentWidth: 4 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Left +ReflowComments: true +SortIncludes: true +SpaceAfterCStyleCast: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: Never +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp11 +TabWidth: 4 +UseTab: Never +... + diff --git a/.cproject b/.cproject index 0d6f091..f813a4e 100644 --- a/.cproject +++ b/.cproject @@ -48,13 +48,14 @@ - + + @@ -127,7 +128,7 @@ - + @@ -163,13 +164,14 @@ - + + diff --git a/CMakeLists.txt b/CMakeLists.txt index de89abb..2adab1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,7 @@ if(CMAKE_PROJECT_NAME STREQUAL "TGC-ISS") set(CORE_NAME TGC5C CACHE STRING "The core to build the ISS for" ) option(FW_BUILD "Enable the automatic download and build of some firmware to run on the ISS" OFF) option(ENABLE_SANITIZER "Enable address sanitizer" OFF) + option(ENABLE_CLANG_TIDY "Add clang-tidy and clang-format automatically to builds" OFF) option(WITH_TCC "Build TCC backend" ON) option(WITH_LLVM "Build LLVM backend" OFF) option(WITH_ASMJIT "Build ASMJIT backend" ON) @@ -155,6 +156,48 @@ if(CMAKE_PROJECT_NAME STREQUAL "TGC-ISS") if(USE_CWR_SYSTEMC) include(SystemCPackage) endif() + ############################################################################### + # setup clang-format and clang-tidy + ############################################################################### + if (ENABLE_CLANG_TIDY) + set(CLANG_FORMAT_EXCLUDE_PATTERNS "scc" "install") + find_package(ClangFormat) + find_program (CLANG_TIDY_EXE NAMES "clang-tidy" PATHS /usr/bin ) + if (CLANG_TIDY_EXE) + message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}") + set(CLANG_TIDY_CHECKS "-*") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-avoid-bind.PermissiveParameterList") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-loop-convert.*") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-make-shared.") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-make-unique.") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-pass-by-value.*") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-raw-string-literal.*") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-replace-auto-ptr.IncludeStyle") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-replace-disallow-copy-and-assign-macro.MacroName") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-replace-random-shuffle.IncludeStyle") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-use-auto.*") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-use-bool-literals.IgnoreMacros") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-use-default-member-init.*") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-use-emplace.*") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-use-equals-default.IgnoreMacros") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-use-equals-delete.IgnoreMacros") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-use-nodiscard.ReplacementString") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-use-noexcept.*") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-use-nullptr.NullMacros") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-use-override.*") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-use-transparent-functors.SafeMode") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},modernize-use-using.IgnoreMacros") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors") + #set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},cppcoreguidelines-*") + set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},clang-diagnostic-*,clang-analyzer-*") + set(DO_CLANG_TIDY "${CLANG_TIDY_EXE};-checks=${CLANG_TIDY_CHECKS};-header-filter='${CMAKE_SOURCE_DIR}/*';-fix" + CACHE STRING "" FORCE) + else() + message(WARNING "clang-tidy not found!") + set(CMAKE_CXX_CLANG_TIDY "" CACHE STRING "" FORCE) # delete it + endif() + endif() + if(FW_BUILD) include(FetchContent) set(FETCHCONTENT_BASE_DIR ${CMAKE_CURRENT_BINARY_DIR}/..) diff --git a/dbt-rise-core b/dbt-rise-core index 99eea61..95e3ccb 160000 --- a/dbt-rise-core +++ b/dbt-rise-core @@ -1 +1 @@ -Subproject commit 99eea614f5cc4e6cc74f671aab2bfa54b941d185 +Subproject commit 95e3ccb2241ef3c7aed7c15452fd1309d225ec58 diff --git a/dbt-rise-tgc b/dbt-rise-tgc index 2115e9c..6419ad4 160000 --- a/dbt-rise-tgc +++ b/dbt-rise-tgc @@ -1 +1 @@ -Subproject commit 2115e9ceaea9540b8998080213b1a79725f5c878 +Subproject commit 6419ad471e3048463084c6a0fbfcf3bedef7bf9d diff --git a/scc b/scc index 609bbbb..b8d4cf0 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit 609bbbb41a2ae9a5c179e7ae0c4d8fccf7eaac29 +Subproject commit b8d4cf0c034147b68038e682dbbd6a59a108434f