Skip to content

Commit

Permalink
partial "-Wmaybe-uninitialized" added
Browse files Browse the repository at this point in the history
  • Loading branch information
rokath committed Nov 24, 2024
1 parent 647aec8 commit 1564d09
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/trice.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,16 @@ unsigned TriceOutDepth(void) {
return depth;
}

#ifdef __GNUC__
// https://stackoverflow.com/questions/5080848/disable-gcc-may-be-used-uninitialized-on-a-particular-variable
#pragma GCC diagnostic push // save the actual diag context
#ifndef __clang__
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // disable maybe warnings
#endif
#endif // #ifdef __GNUC__
// now impacted section of code


//! TRICE_ASSERT writes trice data as fast as possible in a buffer.
//! \param tid is a 16 bit Trice id in upper 2 bytes of a 32 bit value
//! This is a helper macro and should not be used in user code.
Expand Down Expand Up @@ -915,6 +925,10 @@ void TRiceAssertFalse(int idN, char* msg, int flag) {
}
}

#ifdef __GNUC__
#pragma GCC diagnostic pop // restore previous diag context
#endif // #ifdef __GNUC__

#ifdef TRICE_N

void triceN(int tid, char* fmt, void* buf, uint32_t n) {
Expand Down

0 comments on commit 1564d09

Please sign in to comment.