Skip to content

Commit

Permalink
Fix MISRA C 2012 20.12 deviations
Browse files Browse the repository at this point in the history
* Use a local variable here to prevent macro replacement is subjected to
  macro itself.
  • Loading branch information
Ubuntu committed Mar 13, 2024
1 parent dc1ab91 commit de4652f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion source/core_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,15 @@ static void skipScalars( const char * buf,
size_t max,
char mode )
{
assert( isOpenBracket_( mode ) );
bool modeIsOpenBracket = ( bool ) isOpenBracket_( mode );

/* assert function may be implemented in macro using a # or ## operator.
* Using a local variable here to prevent macro replacement is subjected
* to macro itself. */
assert( modeIsOpenBracket != true );

/* Adding this line to avoid unused variable warning in release mode. */
( void ) modeIsOpenBracket;

skipSpace( buf, start, max );

Expand Down

0 comments on commit de4652f

Please sign in to comment.