Skip to content

Commit

Permalink
Fix for coverity issue dead_error_line in max functions
Browse files Browse the repository at this point in the history
Fixed this by adding coverity code that this error is intentional
As fixing this will only make the code generator more complex, and any
optimization of the compiler will eliminate that part of the code

Signed-off-by: Martijn Reicher <[email protected]>
  • Loading branch information
reicheratwork authored and eboasson committed Sep 27, 2023
1 parent dcf2816 commit 0ddd39b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/idlcxx/src/streamers.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,13 +448,15 @@ sequence_writes(const idl_pstate_t* pstate,
const char* sfmt = " if (se_%2$u > 0 &&\n"
" !{T}(streamer, %1$s[0], se_%2$u))\n"
" return false;\n";
const char* mfmt = " if (se_%2$u > 0 &&\n"
const char* mfmt = " %3$s\n"
" if (se_%2$u > 0 &&\n"
" !{T}(streamer, %1$s(), se_%2$u))\n"
" return false;\n";
char* type = NULL;

if (IDL_PRINTA(&type, get_cpp11_type, type_spec, streams->generator) < 0
|| multi_putf(streams, MOVE | MAX, mfmt, type, depth)
|| multi_putf(streams, MOVE, mfmt, type, depth, "")
|| multi_putf(streams, MAX, mfmt, type, depth, "// coverity[dead_error_line]")
|| multi_putf(streams, WRITE, sfmt, accessor, depth)
|| multi_putf(streams, READ, sfmt, read_accessor, depth))
return IDL_RETCODE_NO_MEMORY;
Expand Down

0 comments on commit 0ddd39b

Please sign in to comment.