Skip to content

Commit

Permalink
Merge pull request #495 from Sazerac4/fixes/tests_lib
Browse files Browse the repository at this point in the history
Fixes/lib (warnings compilation)
  • Loading branch information
rokath authored Sep 6, 2024
2 parents 85ae6d6 + fc7fba0 commit bb27fd0
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SkipMacroDefinitionBody: false
SortIncludes: CaseSensitive
SortIncludes: Never
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
Expand Down
6 changes: 6 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#FIXME: used to test. Can be reworked to automatic labelling (fixes, features ,c , go , ...)
# Add 'AnyChange' label to any changes within the entire repository
AnyChange:
- changed-files:
- any-glob-to-any-file: '**'

11 changes: 6 additions & 5 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
# https://github.com/actions/labeler

name: Labeler
on: [pull_request, workflow_dispatch]
on: [pull_request_target, workflow_dispatch]

jobs:
label:

labeler:
runs-on: ubuntu-latest

permissions:
contents: read
pull-requests: write
steps:
- uses: actions/labeler@v2
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
2 changes: 1 addition & 1 deletion examples/OpenCM3_STM32F411_Nucleo/triceConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ extern "C" {
// Optical feedback: Adapt to your device.
//

static inline void ToggleOpticalFeedbackLED( void ){
TRICE_INLINE void ToggleOpticalFeedbackLED( void ){
// The only user controllable LED available on the
// Nucleo is LD2, on port A5. This is set up in main.c
gpio_toggle(GPIOA, GPIO5);
Expand Down
4 changes: 2 additions & 2 deletions src/cobs.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define COBS_H_

#ifdef __cplusplus
extern "C" {
extern "C" {
#endif

#include <stddef.h> //lint !e537 !e451 Warning 537: Repeated include file, Warning 451: Header file repeatedly included but does not have a standard
Expand All @@ -18,7 +18,7 @@ size_t COBSEncode(void* __restrict out, const void* __restrict in, size_t length
size_t COBSDecode(void* __restrict out, const void* __restrict in, size_t length);

#ifdef __cplusplus
}
}
#endif

#endif
4 changes: 2 additions & 2 deletions src/tcobs.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define TCOBS_H_

#ifdef __cplusplus
extern "C" {
extern "C" {
#endif

#include <stddef.h>
Expand Down Expand Up @@ -36,7 +36,7 @@ int TCOBSDecode(void* __restrict output, size_t max, const void* __restrict inpu
#define INPUT_DATA_CORRUPTED -2000000 //!< INPUT_DATA_CORRUPTED is TCOBSDecode return error code.

#ifdef __cplusplus
}
}
#endif

#endif // TCOBS_H_
3 changes: 1 addition & 2 deletions src/tcobsv1Decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
\author Thomas.Hoehenleitner [at] seerose.net
\details See ./TCOBSv1Specification.md.
*******************************************************************************/
// clang-format off

#include <stdint.h>
#include <stddef.h>
#include <string.h> // memcpy
#include "tcobs.h"
#include "tcobsv1Internal.h"
// clang-format on

static int sigilAndOffset(uint8_t* sigil, uint8_t b);
static uint8_t repeatByte(int offset, uint8_t* in, int len);
Expand Down
3 changes: 1 addition & 2 deletions src/tcobsv1Encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
\author Thomas.Hoehenleitner [at] seerose.net
\details See ./TCOBSv1Specification.md.
*******************************************************************************/
// clang-format off

#include <stdint.h>
#include <stddef.h>
#include "tcobs.h"
#include "tcobsv1Internal.h"
// clang-format on

// lint -e801 Info 801: Use of goto is deprecated

Expand Down
4 changes: 2 additions & 2 deletions src/tcobsv1Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define TCOBS_INTERNAL_H_

#ifdef __cplusplus
extern "C" {
extern "C" {
#endif

#define N 0xA0 //!< sigil byte 0x101ooooo, offset 0-31
Expand All @@ -22,7 +22,7 @@
#define R4 0x18 //!< sigil byte 0x00011ooo, offset 0-7

#ifdef __cplusplus
}
}
#endif

#endif // TCOBS_INTERNAL_H_
70 changes: 35 additions & 35 deletions src/trice.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ size_t TriceEncode(unsigned encrypt, unsigned framing, uint8_t* dst, const uint8
unsigned NumWordsAtOnce;
unsigned WrOff;
unsigned RemW;

#if TRICE_PROTECT == 1
unsigned space = SEGGER_RTT_GetAvailWriteSpace(0);
if (space < NumW << 2) {
Expand Down Expand Up @@ -543,7 +543,7 @@ static void TriceDirectWrite32(const uint32_t* buf, unsigned count) {
#else // #if TRICE_PROTECT == 1
SEGGER_Write_RTT0_NoCheck32(buf, count);
#endif // #else // #if TRICE_PROTECT == 1

#if TRICE_DIAGNOSTICS == 1
triceSeggerRTTDiagnostics(); // todo: maybe not needed
#endif
Expand Down Expand Up @@ -703,13 +703,13 @@ static void TriceDirectWrite32(const uint32_t* buf, unsigned count) {
unsigned count = directXEncode32(enc, dat, wordCount); // Up to 3 trailing zeroes are packed as well here.
TriceDirectWrite32(enc, count);
#endif

return;

#elif TRICE_DIRECT8_ALSO // Space at triceStart + wordCount is NOT usable and we can NOT destroy the data.

static uint32_t enc[TRICE_BUFFER_SIZE >> 2]; // stack buffer!

#if (TRICE_DIRECT_XTEA_ENCRYPT == 1)
uint32_t* dat = enc + (TRICE_DATA_OFFSET >> 2);
memcpy(dat, triceStart, wordCount << 2); // Trice data are 32-bit aligned.
Expand All @@ -726,7 +726,7 @@ static void TriceDirectWrite32(const uint32_t* buf, unsigned count) {
unsigned len = directXEncode8(enc, dat, wordCount << 2); // Up to 3 trailing zeroes are packed as well here.
TriceDirectWrite8((uint8_t*)enc, len);
#endif

return;

#else //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -885,127 +885,127 @@ unsigned TriceOutDepth(void) {
#ifdef TRICE_N

void triceN(int tid, char* fmt, void* buf, uint32_t n) {
TRICE_N(id(tid), pFmt, buf, n);
TRICE_N(id(tid), fmt, buf, n);
}

void TriceN(int tid, char* fmt, void* buf, uint32_t n) {
TRICE_N(Id(tid), pFmt, buf, n);
TRICE_N(Id(tid), fmt, buf, n);
}

void TRiceN(int tid, char* fmt, void* buf, uint32_t n) {
TRICE_N(ID(tid), pFmt, buf, n);
TRICE_N(ID(tid), fmt, buf, n);
}

void trice8B(int tid, char* fmt, void* buf, uint32_t n) {
TRICE8_B(id(tid), pFmt, buf, n);
TRICE8_B(id(tid), fmt, buf, n);
}

void Trice8B(int tid, char* fmt, void* buf, uint32_t n) {
TRICE8_B(Id(tid), pFmt, buf, n);
TRICE8_B(Id(tid), fmt, buf, n);
}

void TRice8B(int tid, char* fmt, void* buf, uint32_t n) {
TRICE8_B(ID(tid), pFmt, buf, n);
TRICE8_B(ID(tid), fmt, buf, n);
}

void trice16B(int tid, char* fmt, void* buf, uint32_t n) {
TRICE16_B(id(tid), pFmt, buf, n);
TRICE16_B(id(tid), fmt, buf, n);
}

void Trice16B(int tid, char* fmt, void* buf, uint32_t n) {
TRICE16_B(Id(tid), pFmt, buf, n);
TRICE16_B(Id(tid), fmt, buf, n);
}

void TRice16B(int tid, char* fmt, void* buf, uint32_t n) {
TRICE16_B(ID(tid), pFmt, buf, n);
TRICE16_B(ID(tid), fmt, buf, n);
}

void trice32B(int tid, char* fmt, void* buf, uint32_t n) {
TRICE32_B(id(tid), pFmt, buf, n);
TRICE32_B(id(tid), fmt, buf, n);
}

void Trice32B(int tid, char* fmt, void* buf, uint32_t n) {
TRICE32_B(Id(tid), pFmt, buf, n);
TRICE32_B(Id(tid), fmt, buf, n);
}

void TRice32B(int tid, char* fmt, void* buf, uint32_t n) {
TRICE32_B(ID(tid), pFmt, buf, n);
TRICE32_B(ID(tid), fmt, buf, n);
}

void trice64B(int tid, char* fmt, void* buf, uint32_t n) {
TRICE64_B(id(tid), pFmt, buf, n);
TRICE64_B(id(tid), fmt, buf, n);
}

void Trice64B(int tid, char* fmt, void* buf, uint32_t n) {
TRICE64_B(Id(tid), pFmt, buf, n);
TRICE64_B(Id(tid), fmt, buf, n);
}

void TRice64B(int tid, char* fmt, void* buf, uint32_t n) {
TRICE64_B(ID(tid), pFmt, buf, n);
TRICE64_B(ID(tid), fmt, buf, n);
}

void trice8F(int tid, char* fmt, void* buf, uint32_t n) {
TRICE8_F(id(tid), pFmt, buf, n);
TRICE8_F(id(tid), fmt, buf, n);
}

void Trice8F(int tid, char* fmt, void* buf, uint32_t n) {
TRICE8_F(Id(tid), pFmt, buf, n);
TRICE8_F(Id(tid), fmt, buf, n);
}

void TRice8F(int tid, char* fmt, void* buf, uint32_t n) {
TRICE8_F(ID(tid), pFmt, buf, n);
TRICE8_F(ID(tid), fmt, buf, n);
}

void trice16F(int tid, char* fmt, void* buf, uint32_t n) {
TRICE16_F(id(tid), pFmt, buf, n);
TRICE16_F(id(tid), fmt, buf, n);
}

void Trice16F(int tid, char* fmt, void* buf, uint32_t n) {
TRICE16_F(Id(tid), pFmt, buf, n);
TRICE16_F(Id(tid), fmt, buf, n);
}

void TRice16F(int tid, char* fmt, void* buf, uint32_t n) {
TRICE16_F(ID(tid), pFmt, buf, n);
TRICE16_F(ID(tid), fmt, buf, n);
}

void trice32F(int tid, char* fmt, void* buf, uint32_t n) {
TRICE32_F(id(tid), pFmt, buf, n);
TRICE32_F(id(tid), fmt, buf, n);
}

void Trice32F(int tid, char* fmt, void* buf, uint32_t n) {
TRICE32_F(Id(tid), pFmt, buf, n);
TRICE32_F(Id(tid), fmt, buf, n);
}

void TRice32F(int tid, char* fmt, void* buf, uint32_t n) {
TRICE32_F(ID(tid), pFmt, buf, n);
TRICE32_F(ID(tid), fmt, buf, n);
}

void trice64F(int tid, char* fmt, void* buf, uint32_t n) {
TRICE64_F(id(tid), pFmt, buf, n);
TRICE64_F(id(tid), fmt, buf, n);
}

void Trice64F(int tid, char* fmt, void* buf, uint32_t n) {
TRICE64_F(Id(tid), pFmt, buf, n);
TRICE64_F(Id(tid), fmt, buf, n);
}

void TRice64F(int tid, char* fmt, void* buf, uint32_t n) {
TRICE64_F(ID(tid), pFmt, buf, n);
TRICE64_F(ID(tid), fmt, buf, n);
}

#endif // #ifdef TRICE_N

#ifdef TRICE_S

void triceS(int tid, char* fmt, char* runtimeGeneratedString) {
TRICE_S(id(tid), pFmt, runtimeGeneratedString);
TRICE_S(id(tid), fmt, runtimeGeneratedString);
}

void TriceS(int tid, char* fmt, char* runtimeGeneratedString) {
TRICE_S(Id(tid), pFmt, runtimeGeneratedString);
TRICE_S(Id(tid), fmt, runtimeGeneratedString);
}

void TRiceS(int tid, char* fmt, char* runtimeGeneratedString) {
TRICE_S(ID(tid), pFmt, runtimeGeneratedString);
TRICE_S(ID(tid), fmt, runtimeGeneratedString);
}

#endif // #ifdef TRICE_N
Expand Down
Loading

0 comments on commit bb27fd0

Please sign in to comment.