From e5e807ce8d89d91e582a625a611760d0e7db4407 Mon Sep 17 00:00:00 2001 From: Roy Shilkrot Date: Wed, 17 Jul 2024 22:46:25 -0400 Subject: [PATCH 1/7] chore: Update dependencies and fix formatting issues --- .clang-format | 130 ++++++++++++++++--- .cmake-format.json | 9 -- .github/actions/run-clang-format/action.yaml | 9 +- .github/workflows/build-project.yaml | 12 +- .github/workflows/check-format.yaml | 4 +- .github/workflows/push.yaml | 4 +- CMakePresets.json | 32 ++--- buildspec.json | 30 ++--- src/model-utils/model-downloader-ui.cpp | 3 +- src/whisper-utils/silero-vad-onnx.cpp | 2 +- 10 files changed, 160 insertions(+), 75 deletions(-) diff --git a/.clang-format b/.clang-format index 33a3b3a..afc3dcc 100644 --- a/.clang-format +++ b/.clang-format @@ -1,6 +1,6 @@ -# please use clang-format version 8 or later +# please use clang-format version 16 or later -Standard: Cpp11 +Standard: c++17 AccessModifierOffset: -8 AlignAfterOpenBracket: Align AlignConsecutiveAssignments: false @@ -8,14 +8,14 @@ AlignConsecutiveDeclarations: false AlignEscapedNewlines: Left AlignOperands: true AlignTrailingComments: true -#AllowAllArgumentsOnNextLine: false # requires clang-format 9 -#AllowAllConstructorInitializersOnNextLine: false # requires clang-format 9 +AllowAllArgumentsOnNextLine: false +AllowAllConstructorInitializersOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: Inline AllowShortIfStatementsOnASingleLine: false -#AllowShortLambdasOnASingleLine: Inline # requires clang-format 9 +AllowShortLambdasOnASingleLine: Inline AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None @@ -52,7 +52,7 @@ ContinuationIndentWidth: 8 Cpp11BracedListStyle: true DerivePointerAlignment: false DisableFormat: false -FixNamespaceComments: false +FixNamespaceComments: true ForEachMacros: - 'json_object_foreach' - 'json_object_foreach_safe' @@ -66,7 +66,7 @@ IndentWrappedFunctionNames: false KeepEmptyLinesAtTheStartOfBlocks: true MaxEmptyLinesToKeep: 1 NamespaceIndentation: None -#ObjCBinPackProtocolList: Auto # requires clang-format 7 +ObjCBinPackProtocolList: Auto ObjCBlockIndentWidth: 8 ObjCSpaceAfterProperty: true ObjCSpaceBeforeProtocolList: true @@ -84,13 +84,13 @@ ReflowComments: false SortIncludes: false SortUsingDeclarations: false SpaceAfterCStyleCast: false -#SpaceAfterLogicalNot: false # requires clang-format 9 +SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: false SpaceBeforeAssignmentOperators: true -#SpaceBeforeCtorInitializerColon: true # requires clang-format 7 -#SpaceBeforeInheritanceColon: true # requires clang-format 7 +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements -#SpaceBeforeRangeBasedForLoopColon: true # requires clang-format 7 +SpaceBeforeRangeBasedForLoopColon: true SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInAngles: false @@ -98,11 +98,111 @@ SpacesInCStyleCastParentheses: false SpacesInContainerLiterals: false SpacesInParentheses: false SpacesInSquareBrackets: false -#StatementMacros: # requires clang-format 8 -# - 'Q_OBJECT' +StatementMacros: + - 'Q_OBJECT' TabWidth: 8 -#TypenameMacros: # requires clang-format 9 -# - 'DARRAY' +TypenameMacros: + - 'DARRAY' UseTab: ForContinuationAndIndentation --- Language: ObjC +AccessModifierOffset: 2 +AlignArrayOfStructures: Right +AlignConsecutiveAssignments: None +AlignConsecutiveBitFields: None +AlignConsecutiveDeclarations: None +AlignConsecutiveMacros: + Enabled: true + AcrossEmptyLines: false + AcrossComments: true +AllowShortBlocksOnASingleLine: Never +AllowShortEnumsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: None +AttributeMacros: ['__unused', '__autoreleasing', '_Nonnull', '__bridge'] +BitFieldColonSpacing: Both +#BreakBeforeBraces: Webkit +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: false + AfterClass: true + AfterControlStatement: Never + AfterEnum: false + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: false + SplitEmptyNamespace: true +BreakAfterAttributes: Never +BreakArrays: false +BreakBeforeConceptDeclarations: Allowed +BreakBeforeInlineASMColon: OnlyMultiline +BreakConstructorInitializers: AfterColon +BreakInheritanceList: AfterComma +ColumnLimit: 120 +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +IndentAccessModifiers: false +IndentCaseBlocks: false +IndentCaseLabels: true +IndentExternBlock: Indent +IndentGotoLabels: false +IndentRequiresClause: true +IndentWidth: 4 +IndentWrappedFunctionNames: true +InsertBraces: false +InsertNewlineAtEOF: true +KeepEmptyLinesAtTheStartOfBlocks: false +LambdaBodyIndentation: Signature +NamespaceIndentation: All +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 4 +ObjCBreakBeforeNestedBlockParam: false +ObjCSpaceAfterProperty: true +ObjCSpaceBeforeProtocolList: true +PPIndentWidth: -1 +PackConstructorInitializers: NextLine +QualifierAlignment: Leave +ReferenceAlignment: Right +RemoveSemicolon: false +RequiresClausePosition: WithPreceding +RequiresExpressionIndentation: OuterScope +SeparateDefinitionBlocks: Always +ShortNamespaceLines: 1 +SortIncludes: false +#SortUsingDeclarations: LexicographicNumeric +SortUsingDeclarations: true +SpaceAfterCStyleCast: true +SpaceAfterLogicalNot: false +SpaceAroundPointerQualifiers: Default +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: true +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInConditionalStatement: false +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 +Standard: c++17 +TabWidth: 4 +UseTab: Never diff --git a/.cmake-format.json b/.cmake-format.json index b70e8c5..31bd607 100644 --- a/.cmake-format.json +++ b/.cmake-format.json @@ -6,15 +6,6 @@ "autosort": true }, "additional_commands": { - "find_qt": { - "flags": [], - "kwargs": { - "COMPONENTS": "+", - "COMPONENTS_WIN": "+", - "COMPONENTS_MACOS": "+", - "COMPONENTS_LINUX": "+" - } - }, "set_target_properties_obs": { "pargs": 1, "flags": [], diff --git a/.github/actions/run-clang-format/action.yaml b/.github/actions/run-clang-format/action.yaml index b92910d..e0225c2 100644 --- a/.github/actions/run-clang-format/action.yaml +++ b/.github/actions/run-clang-format/action.yaml @@ -28,7 +28,7 @@ runs: echo ::group::Install Dependencies eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH - echo "/home/linuxbrew/.linuxbrew/opt/clang-format@13/bin" >> $GITHUB_PATH + echo "/home/linuxbrew/.linuxbrew/opt/clang-format@17/bin" >> $GITHUB_PATH brew install --quiet zsh echo ::endgroup:: @@ -51,11 +51,12 @@ runs: } if (( ${changes[(I)(*.c|*.h|*.cpp|*.hpp|*.m|*.mm)]} )) { - echo ::group::Install clang-format-13 - brew install --quiet obsproject/tools/clang-format@13 + echo ::group::Install clang-format-17 + brew install --quiet obsproject/tools/clang-format@17 echo ::endgroup:: - echo ::group::Run clang-format-13 + echo ::group::Run clang-format-17 ./build-aux/run-clang-format --fail-${{ inputs.failCondition }} --check echo ::endgroup:: } + \ No newline at end of file diff --git a/.github/workflows/build-project.yaml b/.github/workflows/build-project.yaml index 787e1fc..8846a92 100644 --- a/.github/workflows/build-project.yaml +++ b/.github/workflows/build-project.yaml @@ -15,7 +15,7 @@ jobs: config: ${{ steps.setup.outputs.config }} commitHash: ${{ steps.setup.outputs.commitHash }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Check Event Data ☑️ @@ -67,7 +67,7 @@ jobs: run: shell: zsh --no-rcs --errexit --pipefail {0} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 @@ -92,7 +92,7 @@ jobs: print "pluginName=${product_name}" >> $GITHUB_OUTPUT print "pluginVersion=${product_version}" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 + - uses: actions/cache@v4 id: ccache-cache with: path: ${{ github.workspace }}/.ccache @@ -161,7 +161,7 @@ jobs: run: shell: bash steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 @@ -178,7 +178,7 @@ jobs: echo "pluginName=${product_name}" >> $GITHUB_OUTPUT echo "pluginVersion=${product_version}" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 + - uses: actions/cache@v4 id: ccache-cache with: path: ${{ github.workspace }}/.ccache @@ -232,7 +232,7 @@ jobs: run: shell: pwsh steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 diff --git a/.github/workflows/check-format.yaml b/.github/workflows/check-format.yaml index bbb3aa2..e30b916 100644 --- a/.github/workflows/check-format.yaml +++ b/.github/workflows/check-format.yaml @@ -5,7 +5,7 @@ jobs: clang-format: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: clang-format check 🐉 @@ -17,7 +17,7 @@ jobs: cmake-format: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: cmake-format check 🎛️ diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 117405b..86f5783 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -59,7 +59,7 @@ jobs: esac - name: Download Build Artifacts 📥 - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 if: fromJSON(steps.check.outputs.validTag) id: download @@ -110,7 +110,7 @@ jobs: - name: Create Release 🛫 if: fromJSON(steps.check.outputs.validTag) id: create_release - uses: softprops/action-gh-release@d4e8205d7e959a9107da6396278b2f1f07af0f9b + uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 with: draft: true prerelease: ${{ fromJSON(steps.check.outputs.prerelease) }} diff --git a/CMakePresets.json b/CMakePresets.json index bc80925..8531afb 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -6,10 +6,19 @@ "patch": 0 }, "configurePresets": [ + { + "name": "template", + "hidden": true, + "cacheVariables": { + "ENABLE_FRONTEND_API": true, + "ENABLE_QT": true + } + }, { "name": "macos", "displayName": "macOS Universal", "description": "Build for macOS 11.0+ (Universal binary)", + "inherits": ["template"], "binaryDir": "${sourceDir}/build_macos", "condition": { "type": "equals", @@ -19,12 +28,9 @@ "generator": "Xcode", "warnings": {"dev": true, "deprecated": true}, "cacheVariables": { - "QT_VERSION": "6", "CMAKE_OSX_DEPLOYMENT_TARGET": "11.0", "CODESIGN_IDENTITY": "$penv{CODESIGN_IDENT}", - "CODESIGN_TEAM": "$penv{CODESIGN_TEAM}", - "ENABLE_FRONTEND_API": true, - "ENABLE_QT": true + "CODESIGN_TEAM": "$penv{CODESIGN_TEAM}" } }, { @@ -41,6 +47,7 @@ "name": "windows-x64", "displayName": "Windows x64", "description": "Build for Windows x64", + "inherits": ["template"], "binaryDir": "${sourceDir}/build_x64", "condition": { "type": "equals", @@ -51,10 +58,7 @@ "architecture": "x64", "warnings": {"dev": true, "deprecated": true}, "cacheVariables": { - "QT_VERSION": "6", - "CMAKE_SYSTEM_VERSION": "10.0.18363.657", - "ENABLE_FRONTEND_API": true, - "ENABLE_QT": true + "CMAKE_SYSTEM_VERSION": "10.0.18363.657" } }, { @@ -70,6 +74,7 @@ "name": "linux-x86_64", "displayName": "Linux x86_64", "description": "Build for Linux x86_64", + "inherits": ["template"], "binaryDir": "${sourceDir}/build_x86_64", "condition": { "type": "equals", @@ -79,10 +84,7 @@ "generator": "Ninja", "warnings": {"dev": true, "deprecated": true}, "cacheVariables": { - "QT_VERSION": "6", - "CMAKE_BUILD_TYPE": "RelWithDebInfo", - "ENABLE_FRONTEND_API": true, - "ENABLE_QT": true + "CMAKE_BUILD_TYPE": "RelWithDebInfo" } }, { @@ -99,6 +101,7 @@ "name": "linux-aarch64", "displayName": "Linux aarch64", "description": "Build for Linux aarch64", + "inherits": ["template"], "binaryDir": "${sourceDir}/build_aarch64", "condition": { "type": "equals", @@ -108,10 +111,7 @@ "generator": "Ninja", "warnings": {"dev": true, "deprecated": true}, "cacheVariables": { - "QT_VERSION": "6", - "CMAKE_BUILD_TYPE": "RelWithDebInfo", - "ENABLE_FRONTEND_API": true, - "ENABLE_QT": true + "CMAKE_BUILD_TYPE": "RelWithDebInfo" } }, { diff --git a/buildspec.json b/buildspec.json index 6a8ba75..d210881 100644 --- a/buildspec.json +++ b/buildspec.json @@ -1,51 +1,43 @@ { "dependencies": { "obs-studio": { - "version": "30.0.2", + "version": "30.1.2", "baseUrl": "https://github.com/obsproject/obs-studio/archive/refs/tags", "label": "OBS sources", "hashes": { - "macos": "be12c3ad0a85713750d8325e4b1db75086223402d7080d0e3c2833d7c5e83c27", - "windows-x64": "970058c49322cfa9cd6d620abb393fed89743ba7e74bd9dbb6ebe0ea8141d9c7" + "macos": "490bae1c392b3b344b0270afd8cb887da4bc50bd92c0c426e96713c1ccb9701a", + "windows-x64": "c2dd03fa7fd01fad5beafce8f7156da11f9ed9a588373fd40b44a06f4c03b867" } }, "prebuilt": { - "version": "2023-11-03", + "version": "2024-03-19", "baseUrl": "https://github.com/obsproject/obs-deps/releases/download", "label": "Pre-Built obs-deps", "hashes": { - "macos": "90c2fc069847ec2768dcc867c1c63b112c615ed845a907dc44acab7a97181974", - "windows-x64": "d0825a6fb65822c993a3059edfba70d72d2e632ef74893588cf12b1f0d329ce6" + "macos": "2e9bfb55a5e0e4c1086fa1fda4cf268debfead473089df2aaea80e1c7a3ca7ff", + "windows-x64": "6e86068371526a967e805f6f9903f9407adb683c21820db5f07da8f30d11e998" } }, "qt6": { - "version": "2023-11-03", + "version": "2024-03-19", "baseUrl": "https://github.com/obsproject/obs-deps/releases/download", "label": "Pre-Built Qt6", "hashes": { - "macos": "ba4a7152848da0053f63427a2a2cb0a199af3992997c0db08564df6f48c9db98", - "windows-x64": "bc57dedf76b47119a6dce0435a2f21b35b08c8f2948b1cb34a157320f77732d1" + "macos": "694f1e639c017e3b1f456f735330dc5afae287cbea85757101af1368de3142c8", + "windows-x64": "72d1df34a0ef7413a681d5fcc88cae81da60adc03dcd23ef17862ab170bcc0dd" }, "debugSymbols": { - "windows-x64": "fd8ecd1d8cd2ef049d9f4d7fb5c134f784836d6020758094855dfa98bd025036" + "windows-x64": "fbddd1f659c360f2291911ac5709b67b6f8182e6bca519d24712e4f6fd3cc865" } } }, - "tools": { - "packages": { - "version": "1.2.10", - "baseUrl": "http://s.sudre.free.fr/Software/files", - "label": "Packages.app", - "hash": "6afdd25386295974dad8f078b8f1e41cabebd08e72d970bf92f707c7e48b16c9" - } - }, "platformConfig": { "macos": { "bundleId": "com.royshilkrot.obs-cleanstream" } }, "name": "obs-cleanstream", - "version": "0.0.9", + "version": "0.1.0", "author": "Roy Shilkrot", "website": "https://github.com/occ-ai/obs-cleanstream/", "email": "roy.shil@gmail.com", diff --git a/src/model-utils/model-downloader-ui.cpp b/src/model-utils/model-downloader-ui.cpp index c438654..f7305b0 100644 --- a/src/model-utils/model-downloader-ui.cpp +++ b/src/model-utils/model-downloader-ui.cpp @@ -14,7 +14,8 @@ size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream) ModelDownloader::ModelDownloader(const ModelInfo &model_info, download_finished_callback_t download_finished_callback_, QWidget *parent) - : QDialog(parent), download_finished_callback(download_finished_callback_) + : QDialog(parent), + download_finished_callback(download_finished_callback_) { this->setWindowTitle("Downloading model..."); this->setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::CustomizeWindowHint); diff --git a/src/whisper-utils/silero-vad-onnx.cpp b/src/whisper-utils/silero-vad-onnx.cpp index 1d57663..54efa9d 100644 --- a/src/whisper-utils/silero-vad-onnx.cpp +++ b/src/whisper-utils/silero-vad-onnx.cpp @@ -15,7 +15,7 @@ // #define __DEBUG_SPEECH_PROB___ -timestamp_t::timestamp_t(int start_, int end_) : start(start_), end(end_){}; +timestamp_t::timestamp_t(int start_, int end_) : start(start_), end(end_) {}; // assignment operator modifies object, therefore non-const timestamp_t ×tamp_t::operator=(const timestamp_t &a) From 9824c9c6a2ca6c04da4aa70c6a49a5bbd6e12d2f Mon Sep 17 00:00:00 2001 From: Roy Shilkrot Date: Wed, 17 Jul 2024 23:05:49 -0400 Subject: [PATCH 2/7] chore: Patch libobs and update compiler options --- cmake/common/buildspec_common.cmake | 7 ------- cmake/common/compiler_common.cmake | 3 ++- cmake/linux/compilerconfig.cmake | 2 +- cmake/windows/compilerconfig.cmake | 6 +++++- patch_libobs.diff | 6 ------ 5 files changed, 8 insertions(+), 16 deletions(-) delete mode 100644 patch_libobs.diff diff --git a/cmake/common/buildspec_common.cmake b/cmake/common/buildspec_common.cmake index d0f43c7..b2c2414 100644 --- a/cmake/common/buildspec_common.cmake +++ b/cmake/common/buildspec_common.cmake @@ -73,13 +73,6 @@ function(_setup_obs_studio) set(_cmake_version "3.0.0") endif() - message(STATUS "Patch libobs") - execute_process( - COMMAND patch --forward "libobs/CMakeLists.txt" "${CMAKE_CURRENT_SOURCE_DIR}/patch_libobs.diff" - RESULT_VARIABLE _process_result - WORKING_DIRECTORY "${dependencies_dir}/${_obs_destination}") - message(STATUS "Patch - done") - message(STATUS "Configure ${label} (${arch})") execute_process( COMMAND diff --git a/cmake/common/compiler_common.cmake b/cmake/common/compiler_common.cmake index 8ac423f..6cd5fb1 100644 --- a/cmake/common/compiler_common.cmake +++ b/cmake/common/compiler_common.cmake @@ -24,7 +24,6 @@ set(_obs_clang_c_options -Wbool-conversion -Wcomma -Wconstant-conversion - -Wdeprecated-declarations -Wempty-body -Wenum-conversion -Werror=return-type @@ -36,6 +35,8 @@ set(_obs_clang_c_options -Wint-conversion -Wnewline-eof -Wno-conversion + -Wno-deprecated-declarations + -Wno-error=deprecated-declarations -Wno-float-conversion -Wno-implicit-fallthrough -Wno-missing-braces diff --git a/cmake/linux/compilerconfig.cmake b/cmake/linux/compilerconfig.cmake index 3d1c95f..647c4b3 100644 --- a/cmake/linux/compilerconfig.cmake +++ b/cmake/linux/compilerconfig.cmake @@ -13,7 +13,6 @@ set(_obs_gcc_c_options # cmake-format: sortable -fno-strict-aliasing -fopenmp-simd - -Wdeprecated-declarations -Wempty-body -Wenum-conversion -Werror=return-type @@ -21,6 +20,7 @@ set(_obs_gcc_c_options -Wformat -Wformat-security -Wno-conversion + -Wno-deprecated-declarations -Wno-error=deprecated-declarations -Wno-float-conversion -Wno-implicit-fallthrough diff --git a/cmake/windows/compilerconfig.cmake b/cmake/windows/compilerconfig.cmake index 7af3c4d..edc6188 100644 --- a/cmake/windows/compilerconfig.cmake +++ b/cmake/windows/compilerconfig.cmake @@ -20,7 +20,11 @@ if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION VERSION_LESS 10.0.20348) endif() add_compile_options( - /W3 /utf-8 "$<$:/MP>" "$<$:/MP>" + /W3 + /utf-8 + /wd4996 + "$<$:/MP>" + "$<$:/MP>" "$<$:${_obs_clang_c_options}>" "$<$:${_obs_clang_cxx_options}>") diff --git a/patch_libobs.diff b/patch_libobs.diff deleted file mode 100644 index bdf6059..0000000 --- a/patch_libobs.diff +++ /dev/null @@ -1,6 +0,0 @@ -265a266,267 -> media-io/audio-resampler.h -> media-io/audio-math.h -288a291,292 -> util/circlebuf.h -> util/threading.h From 4cf6f3dfe1a2d192a3547e7af671a5674b63c5e0 Mon Sep 17 00:00:00 2001 From: Roy Shilkrot Date: Wed, 17 Jul 2024 23:18:10 -0400 Subject: [PATCH 3/7] chore: Update clang-format version requirement to 17.0.3 or above --- build-aux/.run-format.zsh | 14 +++++++------- cmake/macos/compilerconfig.cmake | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/build-aux/.run-format.zsh b/build-aux/.run-format.zsh index a71ffff..0258686 100755 --- a/build-aux/.run-format.zsh +++ b/build-aux/.run-format.zsh @@ -29,23 +29,23 @@ invoke_formatter() { case ${1} { clang) - if (( ${+commands[clang-format-13]} )) { - local formatter=clang-format-13 + if (( ${+commands[clang-format-17]} )) { + local formatter=clang-format-17 } elif (( ${+commands[clang-format]} )) { local formatter=clang-format local -a formatter_version=($(clang-format --version)) - if ! is-at-least 13.0.1 ${formatter_version[-1]}; then - log_error "clang-format is not version 13.0.1 or above (found ${formatter_version[-1]}." + if ! is-at-least 17.0.3 ${formatter_version[-1]}; then + log_error "clang-format is not version 17.0.3 or above (found ${formatter_version[-1]}." exit 2 fi - if ! is-at-least ${formatter_version[-1]} 13.0.1; then - log_error "clang-format is more recent than version 13.0.1 (found ${formatter_version[-1]})." + if ! is-at-least ${formatter_version[-1]} 17.0.3; then + log_error "clang-format is more recent than version 17.0.3 (found ${formatter_version[-1]})." exit 2 fi } else { - log_error "No viable clang-format version found (required 13.0.1)" + log_error "No viable clang-format version found (required 17.0.3)" exit 2 } diff --git a/cmake/macos/compilerconfig.cmake b/cmake/macos/compilerconfig.cmake index c40a532..a2186e7 100644 --- a/cmake/macos/compilerconfig.cmake +++ b/cmake/macos/compilerconfig.cmake @@ -55,3 +55,4 @@ else() endif() add_compile_definitions($<$:DEBUG> $<$:_DEBUG> SIMDE_ENABLE_OPENMP) +add_compile_options(-Wno-error=deprecated-declarations -Wno-deprecated-declarations) From 087fe5cb39f56a619a3fd7a3381278edce5cdb0d Mon Sep 17 00:00:00 2001 From: Roy Shilkrot Date: Wed, 17 Jul 2024 23:31:29 -0400 Subject: [PATCH 4/7] refactor: Improve readability of lead_byte_length function --- src/whisper-utils/whisper-utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/whisper-utils/whisper-utils.cpp b/src/whisper-utils/whisper-utils.cpp index 2a5808b..985ec41 100644 --- a/src/whisper-utils/whisper-utils.cpp +++ b/src/whisper-utils/whisper-utils.cpp @@ -147,8 +147,8 @@ void start_whisper_thread_with_path(struct cleanstream_data *gf, const std::stri gf->whisper_thread.swap(new_whisper_thread); } -#define is_lead_byte(c) (((c)&0xe0) == 0xc0 || ((c)&0xf0) == 0xe0 || ((c)&0xf8) == 0xf0) -#define is_trail_byte(c) (((c)&0xc0) == 0x80) +#define is_lead_byte(c) (((c) & 0xe0) == 0xc0 || ((c) & 0xf0) == 0xe0 || ((c) & 0xf8) == 0xf0) +#define is_trail_byte(c) (((c) & 0xc0) == 0x80) inline int lead_byte_length(const uint8_t c) { From ef04b7982357ecdcd85ab129d9342c55080aee31 Mon Sep 17 00:00:00 2001 From: Roy Shilkrot Date: Wed, 17 Jul 2024 23:48:22 -0400 Subject: [PATCH 5/7] chore: Update run-clang-format action to include verbose output --- .github/actions/run-clang-format/action.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/run-clang-format/action.yaml b/.github/actions/run-clang-format/action.yaml index e0225c2..56658d0 100644 --- a/.github/actions/run-clang-format/action.yaml +++ b/.github/actions/run-clang-format/action.yaml @@ -56,7 +56,6 @@ runs: echo ::endgroup:: echo ::group::Run clang-format-17 - ./build-aux/run-clang-format --fail-${{ inputs.failCondition }} --check + ./build-aux/run-clang-format --fail-${{ inputs.failCondition }} --check -v -v -v echo ::endgroup:: } - \ No newline at end of file From 6575da9a6ed7da5efb94fa295bf8c801297e90a5 Mon Sep 17 00:00:00 2001 From: Roy Shilkrot Date: Wed, 17 Jul 2024 23:51:58 -0400 Subject: [PATCH 6/7] chore: Update run-clang-format action to include debug output --- .github/actions/run-clang-format/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/run-clang-format/action.yaml b/.github/actions/run-clang-format/action.yaml index 56658d0..86a116d 100644 --- a/.github/actions/run-clang-format/action.yaml +++ b/.github/actions/run-clang-format/action.yaml @@ -56,6 +56,6 @@ runs: echo ::endgroup:: echo ::group::Run clang-format-17 - ./build-aux/run-clang-format --fail-${{ inputs.failCondition }} --check -v -v -v + ./build-aux/run-clang-format --fail-${{ inputs.failCondition }} --check --debug echo ::endgroup:: } From 3e766d35022010501c9f7e4b75bfbffabf19df87 Mon Sep 17 00:00:00 2001 From: Roy Shilkrot Date: Thu, 18 Jul 2024 01:43:13 -0400 Subject: [PATCH 7/7] chore: Prevent clang-format from reformatting the code --- src/whisper-utils/silero-vad-onnx.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/whisper-utils/silero-vad-onnx.cpp b/src/whisper-utils/silero-vad-onnx.cpp index 54efa9d..b3d4487 100644 --- a/src/whisper-utils/silero-vad-onnx.cpp +++ b/src/whisper-utils/silero-vad-onnx.cpp @@ -15,6 +15,8 @@ // #define __DEBUG_SPEECH_PROB___ +// prevent clang-format from reformatting the code +// clang-format off timestamp_t::timestamp_t(int start_, int end_) : start(start_), end(end_) {}; // assignment operator modifies object, therefore non-const