DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] test/test_external_mem: fix loop initialization
@ 2018-10-23  7:35 Ali Alnubani
  2018-10-23  9:06 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Ali Alnubani @ 2018-10-23  7:35 UTC (permalink / raw)
  To: dev; +Cc: Thomas Monjalon, anatoly.burakov

Loop initial declarations are only allowed in C99 mode,
which causes a compilation failure on non C99 compliant systems:

test/test/test_external_mem.c: In function ‘test_external_mem’:
test/test/test_external_mem.c:375:2: error: ‘for’
loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < n_pages; i++) {
  ^

Reproduces on RHEL 7.4 with GCC 4.8.5 20150623 (Red Hat 4.8.5-16).

Fixes: b270daa43b3d ("test: support external memory")
Cc: anatoly.burakov@intel.com

Signed-off-by: Ali Alnubani <alialnu@mellanox.com>
---
 test/test/test_external_mem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/test/test_external_mem.c b/test/test/test_external_mem.c
index d0837aa35..d740960ce 100644
--- a/test/test/test_external_mem.c
+++ b/test/test/test_external_mem.c
@@ -361,7 +361,7 @@ test_external_mem(void)
 	size_t pgsz = RTE_PGSIZE_4K;
 	rte_iova_t iova[len / pgsz];
 	void *addr;
-	int ret, n_pages;
+	int ret, n_pages, i;
 
 	/* create external memory area */
 	n_pages = RTE_DIM(iova);
@@ -372,7 +372,7 @@ test_external_mem(void)
 			__func__, __LINE__);
 		return -1;
 	}
-	for (int i = 0; i < n_pages; i++) {
+	for (i = 0; i < n_pages; i++) {
 		/* arbitrary IOVA */
 		rte_iova_t tmp = 0x100000000 + i * pgsz;
 		iova[i] = tmp;
-- 
2.19.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] test/test_external_mem: fix loop initialization
  2018-10-23  7:35 [dpdk-dev] [PATCH] test/test_external_mem: fix loop initialization Ali Alnubani
@ 2018-10-23  9:06 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2018-10-23  9:06 UTC (permalink / raw)
  To: Ali Alnubani; +Cc: dev

23/10/2018 09:35, Ali Alnubani:
> Loop initial declarations are only allowed in C99 mode,
> which causes a compilation failure on non C99 compliant systems:
> 
> test/test/test_external_mem.c: In function ‘test_external_mem’:
> test/test/test_external_mem.c:375:2: error: ‘for’
> loop initial declarations are only allowed in C99 mode
>   for (int i = 0; i < n_pages; i++) {
>   ^
> 
> Reproduces on RHEL 7.4 with GCC 4.8.5 20150623 (Red Hat 4.8.5-16).
> 
> Fixes: b270daa43b3d ("test: support external memory")
> Cc: anatoly.burakov@intel.com
> 
> Signed-off-by: Ali Alnubani <alialnu@mellanox.com>

There was already a patch from Dan Gora:
	http://patches.dpdk.org/patch/46921/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-23  9:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-23  7:35 [dpdk-dev] [PATCH] test/test_external_mem: fix loop initialization Ali Alnubani
2018-10-23  9:06 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).