From 7d9672bb2d1c905ae556acf78a0fdd3562a2e926 Mon Sep 17 00:00:00 2001 From: rusdacent Date: Tue, 20 Oct 2020 05:58:22 +0300 Subject: [PATCH 1/5] refs #146 update version clang-format --- docker/Dockerfile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index f5918029..c1b815d0 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -4,6 +4,8 @@ ENV PATH /root/.cargo/bin:$PATH RUN apt update && \ apt install -y --no-install-recommends \ + software-properties-common \ + gpg-agent \ make \ gcc-arm-none-eabi \ binutils-arm-none-eabi \ @@ -19,11 +21,17 @@ RUN apt update && \ python \ python-pip \ libstdc++-arm-none-eabi-newlib \ - libclang-10-dev \ - clang-format-10 \ git \ && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add - && add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main" + +RUN apt update && \ + apt install -y --no-install-recommends \ + libclang-11-dev \ + clang-format-11 \ + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile=minimal --target thumbv7em-none-eabi thumbv7em-none-eabihf && \ rustup component add rustfmt --toolchain stable-x86_64-unknown-linux-gnu From 2b513d381b6123637cfdc1aec5074435b3a42a97 Mon Sep 17 00:00:00 2001 From: rusdacent Date: Tue, 20 Oct 2020 08:38:53 +0300 Subject: [PATCH 2/5] refs #146 fix path for clang-format in syntax-check --- docker/syntax_check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/syntax_check.sh b/docker/syntax_check.sh index 0294b696..d45b41b7 100755 --- a/docker/syntax_check.sh +++ b/docker/syntax_check.sh @@ -2,7 +2,7 @@ # set -e -CLANG_FORMAT_BIN="/usr/bin/clang-format-10" +CLANG_FORMAT_BIN="/usr/bin/clang-format-11" PATH="$HOME/.cargo/bin:${PATH}" PROJECT_DIR=$(pwd) From 430815d5619c8b17185d2059954f0148564cf9f6 Mon Sep 17 00:00:00 2001 From: DrZlo13 Date: Tue, 20 Oct 2020 19:23:53 +1000 Subject: [PATCH 3/5] now asserts dont break anything in release mode --- applications/gui/gui_event.c | 16 ++++++++++++---- applications/menu/menu_event.c | 4 +++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/applications/gui/gui_event.c b/applications/gui/gui_event.c index 44b4d5fc..7c727206 100644 --- a/applications/gui/gui_event.c +++ b/applications/gui/gui_event.c @@ -41,20 +41,26 @@ GuiEvent* gui_event_alloc() { } void gui_event_free(GuiEvent* gui_event) { + osStatus_t status; assert(gui_event); gui_event_unlock(gui_event); - assert(osMessageQueueDelete(gui_event->mqueue) == osOK); + status = osMessageQueueDelete(gui_event->mqueue); + assert(status == osOK); free(gui_event); } void gui_event_lock(GuiEvent* gui_event) { + osStatus_t status; assert(gui_event); - assert(osMutexAcquire(gui_event->lock_mutex, osWaitForever) == osOK); + status = osMutexAcquire(gui_event->lock_mutex, osWaitForever); + assert(status == osOK); } void gui_event_unlock(GuiEvent* gui_event) { + osStatus_t status; assert(gui_event); - assert(osMutexRelease(gui_event->lock_mutex) == osOK); + status = osMutexRelease(gui_event->lock_mutex); + assert(status == osOK); } void gui_event_messsage_send(GuiEvent* gui_event, GuiMessage* message) { @@ -64,10 +70,12 @@ void gui_event_messsage_send(GuiEvent* gui_event, GuiMessage* message) { } GuiMessage gui_event_message_next(GuiEvent* gui_event) { + osStatus_t status; assert(gui_event); GuiMessage message; gui_event_unlock(gui_event); - assert(osMessageQueueGet(gui_event->mqueue, &message, NULL, osWaitForever) == osOK); + status = osMessageQueueGet(gui_event->mqueue, &message, NULL, osWaitForever); + assert(status == osOK); gui_event_lock(gui_event); return message; } diff --git a/applications/menu/menu_event.c b/applications/menu/menu_event.c index 4470ffd6..af0f1227 100644 --- a/applications/menu/menu_event.c +++ b/applications/menu/menu_event.c @@ -35,8 +35,10 @@ MenuEvent* menu_event_alloc() { } void menu_event_free(MenuEvent* menu_event) { + osStatus_t status; assert(menu_event); - assert(osMessageQueueDelete(menu_event->mqueue) == osOK); + status = osMessageQueueDelete(menu_event->mqueue); + assert(status == osOK); free(menu_event); } From ebd712015123a37ab97034723a3409f63d062c8e Mon Sep 17 00:00:00 2001 From: rusdacent Date: Tue, 20 Oct 2020 13:41:00 +0300 Subject: [PATCH 4/5] refs #146 bump clang-format version to 12 --- docker/Dockerfile | 6 +++--- docker/syntax_check.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index c1b815d0..22174fbc 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -24,12 +24,12 @@ RUN apt update && \ git \ && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add - && add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main" +RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add - && add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main" RUN apt update && \ apt install -y --no-install-recommends \ - libclang-11-dev \ - clang-format-11 \ + libclang-12-dev \ + clang-format-12 \ && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile=minimal --target thumbv7em-none-eabi thumbv7em-none-eabihf && \ diff --git a/docker/syntax_check.sh b/docker/syntax_check.sh index d45b41b7..e7be6a8e 100755 --- a/docker/syntax_check.sh +++ b/docker/syntax_check.sh @@ -2,7 +2,7 @@ # set -e -CLANG_FORMAT_BIN="/usr/bin/clang-format-11" +CLANG_FORMAT_BIN="/usr/bin/clang-format-12" PATH="$HOME/.cargo/bin:${PATH}" PROJECT_DIR=$(pwd) From e95db0eeddd246d54bb1dec19b340bfde3431cab Mon Sep 17 00:00:00 2001 From: aanper Date: Wed, 21 Oct 2020 12:08:23 +0300 Subject: [PATCH 5/5] update AllowShortBlocksOnASingleLine param (not work) --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index 756e3ff9..6a2af9ee 100644 --- a/.clang-format +++ b/.clang-format @@ -6,7 +6,7 @@ AlignEscapedNewlines: Left AlignOperands: true AlignTrailingComments: false AllowAllParametersOfDeclarationOnNextLine: false -AllowShortBlocksOnASingleLine: false +AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: None AllowShortIfStatementsOnASingleLine: true