diff options
author | Chris Luke <chrisy@flirble.org> | 2016-07-22 09:40:19 -0400 |
---|---|---|
committer | Chris Luke <chrisy@flirble.org> | 2016-07-22 10:13:41 -0400 |
commit | 1642e3903d5467baf88531c96c733c285418b953 (patch) | |
tree | c7081b08e84d4f449b39ab34003cbd344cfb2661 /vppapigen/node.c | |
parent | 1f0da170e818a6991d841df47de0885da720b0c3 (diff) |
VPP-189 Fix 137 coverity no-op issues from vpeapigen
vpeapigen is not properly detecting no-op endian swap operations (on u8
or u8[] types) which in turn causes Coverity to currently report ~137
minor issues from the generated vpe.api.h file.
This patch makes vpeapigen comment out those no-op situations thus:
/* a->interface_name[0..63] = a->interface_name[0..63] (no-op) */
/* a->admin_up_down = a->admin_up_down (no-op) */
Change-Id: Ifbc5c93e1939206656e0515b528a4d167c539fd2
Signed-off-by: Chris Luke <chrisy@flirble.org>
Diffstat (limited to 'vppapigen/node.c')
-rw-r--r-- | vppapigen/node.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/vppapigen/node.c b/vppapigen/node.c index ef812787c8a..ab8adc568c6 100644 --- a/vppapigen/node.c +++ b/vppapigen/node.c @@ -172,7 +172,7 @@ void node_u8_generate (node_t *this, enum passid which, FILE *ofp) node_vft_t node_u8_vft = { node_u8_print, node_u8_generate, - "" + NULL }; void node_u16_print (node_t *this) @@ -527,7 +527,7 @@ void node_scalar_generate (node_t *this, enum passid which, FILE *fp) CDATA0, current_endianfun, union_prefix, CDATA0); } else { - fprintf(fp, "/* a->%s%s = a->%s%s */\n", + fprintf(fp, "/* a->%s%s = a->%s%s (no-op) */\n", union_prefix, CDATA0, union_prefix, CDATA0); } @@ -611,6 +611,16 @@ void node_vector_generate (node_t *this, enum passid which, FILE *fp) /* Don't bother about "u8 data [0];" et al. */ if (IDATA1 == 0) break; + /* If this is a simple endian swap, but the endian swap method is a no-op, + * then indicate this is a no-op in a comment. + */ + if (!current_is_complex && current_endianfun == NULL) { + indent_me(fp); + fprintf(fp, "/* a->%s%s[0..%d] = a->%s%s[0..%d] (no-op) */\n", + union_prefix, CDATA0, IDATA1 - 1, + union_prefix, CDATA0, IDATA1 - 1); + break; + } indent_me(fp); fprintf(fp, "{\n"); |