[dpdk-dev] app: fix gcc -O3 compiler errors

Message ID 20170815135305.70024-1-keith.wiles@intel.com (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Wiles, Keith Aug. 15, 2017, 1:53 p.m. UTC
  When using EXTRA_CFLAGS="-g -O3" in the build the -O3 causes
compiler warnings for these two applications. Using Ubuntu 17.04
gcc compiler.

Signed-off-by: Keith Wiles <keith.wiles@intel.com>
---
 app/proc_info/main.c                     | 4 +++-
 app/test-crypto-perf/cperf_test_verify.c | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
  

Comments

Burakov, Anatoly Oct. 4, 2017, 12:59 p.m. UTC | #1
On 15-Aug-17 2:53 PM, Keith Wiles wrote:
> When using EXTRA_CFLAGS="-g -O3" in the build the -O3 causes
> compiler warnings for these two applications. Using Ubuntu 17.04
> gcc compiler.
> 
> Signed-off-by: Keith Wiles <keith.wiles at intel.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
  
Thomas Monjalon Oct. 6, 2017, 10 p.m. UTC | #2
04/10/2017 14:59, Burakov, Anatoly:
> On 15-Aug-17 2:53 PM, Keith Wiles wrote:
> > When using EXTRA_CFLAGS="-g -O3" in the build the -O3 causes
> > compiler warnings for these two applications. Using Ubuntu 17.04
> > gcc compiler.
> > 
> > Signed-off-by: Keith Wiles <keith.wiles at intel.com>
> 
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

Rebased and re-targetted to procinfo only as the crypto app
is already fixed by Olivier for -Og compilation.

Applied, thanks
  

Patch

diff --git a/app/proc_info/main.c b/app/proc_info/main.c
index 8b753a2ee..12566e27d 100644
--- a/app/proc_info/main.c
+++ b/app/proc_info/main.c
@@ -524,7 +524,9 @@  nic_xstats_display(uint8_t port_id)
 			sprintf(buf, "PUTVAL %s/dpdkstat-port.%u/%s-%s N:%"
 				PRIu64"\n", host_id, port_id, counter_type,
 				xstats_names[i].name, values[i]);
-			write(stdout_fd, buf, strlen(buf));
+			ret = write(stdout_fd, buf, strlen(buf));
+			if (ret < 0)
+				goto err;
 		} else {
 			printf("%s: %"PRIu64"\n", xstats_names[i].name,
 					values[i]);
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index a314646c2..4548e7241 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -366,6 +366,8 @@  cperf_verify_op(struct rte_crypto_op *op,
 		auth = 1;
 		auth_offset = vector->aad.length + options->test_buffer_size;
 		break;
+	default:
+		return 1;
 	}
 
 	if (cipher == 1) {