Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH luajit] test: fix libfficcall compilation for old GCC
@ 2026-06-08 10:23 Sergey Kaplun via Tarantool-patches
  2026-06-09 13:55 ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2026-06-08 10:23 UTC (permalink / raw)
  To: Sergey Bronnikov, Evgeniy Temirgaleev; +Cc: tarantool-patches

On CentOS 7 GCC has no std=c99 by default. This leads to compilation
warnings and errors for ‘for’ loop initial declarations. This patch
fixes that by declaring the variable out of the loop body.
---

Branch: https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-fix-tests-old-gcc
CI failure: https://github.com/tarantool/luajit/actions/runs/27124968515/job/80063067169#step:6:10593

 test/tarantool-tests/ffi-ccall/libfficcall.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/tarantool-tests/ffi-ccall/libfficcall.c b/test/tarantool-tests/ffi-ccall/libfficcall.c
index 2145b556..129bc75d 100644
--- a/test/tarantool-tests/ffi-ccall/libfficcall.c
+++ b/test/tarantool-tests/ffi-ccall/libfficcall.c
@@ -307,7 +307,8 @@ int test_2_large_agg_a16(int x, large_agg_a16 s1, large_agg_a16 s2)
 	const int *v1 = s1.v;
 	const int *v2 = s2.v;
 	int sum = x;
-	for (int i = 0; i < lengthof(s1.v); i++) {
+	int i = 0;
+	for (; i < lengthof(s1.v); i++) {
 		sum += v1[i] + v2[i];
 	}
 	return sum;
-- 
2.54.0


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

* Re: [Tarantool-patches] [PATCH luajit] test: fix libfficcall compilation for old GCC
  2026-06-08 10:23 [Tarantool-patches] [PATCH luajit] test: fix libfficcall compilation for old GCC Sergey Kaplun via Tarantool-patches
@ 2026-06-09 13:55 ` Sergey Bronnikov via Tarantool-patches
  2026-06-09 18:00   ` Sergey Kaplun via Tarantool-patches
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2026-06-09 13:55 UTC (permalink / raw)
  To: Sergey Kaplun, Evgeniy Temirgaleev; +Cc: tarantool-patches

[-- Attachment #1: Type: text/plain, Size: 1355 bytes --]

Hello, Sergey,

Thanks for the patch! LGTM with a minor comment.

Sergey

On 6/8/26 13:23, Sergey Kaplun wrote:
> On CentOS 7 GCC has no std=c99 by default. This leads to compilation
> warnings and errors for ‘for’ loop initial declarations. This patch
> fixes that by declaring the variable out of the loop body.
> ---
>
> Branch:https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-fix-tests-old-gcc
> CI failure:https://github.com/tarantool/luajit/actions/runs/27124968515/job/80063067169#step:6:10593
>
>   test/tarantool-tests/ffi-ccall/libfficcall.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/test/tarantool-tests/ffi-ccall/libfficcall.c b/test/tarantool-tests/ffi-ccall/libfficcall.c
> index 2145b556..129bc75d 100644
> --- a/test/tarantool-tests/ffi-ccall/libfficcall.c
> +++ b/test/tarantool-tests/ffi-ccall/libfficcall.c
> @@ -307,7 +307,8 @@ int test_2_large_agg_a16(int x, large_agg_a16 s1, large_agg_a16 s2)
>   	const int *v1 = s1.v;
>   	const int *v2 = s2.v;
>   	int sum = x;
> -	for (int i = 0; i < lengthof(s1.v); i++) {
> +	int i = 0;
> +	for (; i < lengthof(s1.v); i++) {

isn't better declaring outside the loop and define in a loop?

int i;
for (i = 0; i < lengthof(s1.v); i++) {

It looks more familiar this way. Feel free to ignore.

>   		sum += v1[i] + v2[i];
>   	}
>   	return sum;

[-- Attachment #2: Type: text/html, Size: 2395 bytes --]

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

* Re: [Tarantool-patches] [PATCH luajit] test: fix libfficcall compilation for old GCC
  2026-06-09 13:55 ` Sergey Bronnikov via Tarantool-patches
@ 2026-06-09 18:00   ` Sergey Kaplun via Tarantool-patches
  0 siblings, 0 replies; 3+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2026-06-09 18:00 UTC (permalink / raw)
  To: Sergey Bronnikov; +Cc: tarantool-patches

Sergey,
Thanks for the review!
Fixed your comment and force-pushed the branch.

On 09.06.26, Sergey Bronnikov wrote:
> Hello, Sergey,
> 
> Thanks for the patch! LGTM with a minor comment.
> 
> Sergey
> 
> On 6/8/26 13:23, Sergey Kaplun wrote:
> > On CentOS 7 GCC has no std=c99 by default. This leads to compilation
> > warnings and errors for ‘for’ loop initial declarations. This patch
> > fixes that by declaring the variable out of the loop body.
> > ---
> >
> > Branch:https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-fix-tests-old-gcc
> > CI failure:https://github.com/tarantool/luajit/actions/runs/27124968515/job/80063067169#step:6:10593
> >
> >   test/tarantool-tests/ffi-ccall/libfficcall.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/test/tarantool-tests/ffi-ccall/libfficcall.c b/test/tarantool-tests/ffi-ccall/libfficcall.c
> > index 2145b556..129bc75d 100644
> > --- a/test/tarantool-tests/ffi-ccall/libfficcall.c
> > +++ b/test/tarantool-tests/ffi-ccall/libfficcall.c
> > @@ -307,7 +307,8 @@ int test_2_large_agg_a16(int x, large_agg_a16 s1, large_agg_a16 s2)
> >   	const int *v1 = s1.v;
> >   	const int *v2 = s2.v;
> >   	int sum = x;
> > -	for (int i = 0; i < lengthof(s1.v); i++) {
> > +	int i = 0;
> > +	for (; i < lengthof(s1.v); i++) {
> 
> isn't better declaring outside the loop and define in a loop?
> 
> int i;
> for (i = 0; i < lengthof(s1.v); i++) {
> 
> It looks more familiar this way. Feel free to ignore.

Fixed:

===================================================================
diff --git a/test/tarantool-tests/ffi-ccall/libfficcall.c b/test/tarantool-tests/ffi-ccall/libfficcall.c
index 129bc75d..85d76436 100644
--- a/test/tarantool-tests/ffi-ccall/libfficcall.c
+++ b/test/tarantool-tests/ffi-ccall/libfficcall.c
@@ -307,8 +307,8 @@ int test_2_large_agg_a16(int x, large_agg_a16 s1, large_agg_a16 s2)
         const int *v1 = s1.v;
         const int *v2 = s2.v;
         int sum = x;
-        int i = 0;
-        for (; i < lengthof(s1.v); i++) {
+        int i;
+        for (i = 0; i < lengthof(s1.v); i++) {
                 sum += v1[i] + v2[i];
         }
         return sum;
===================================================================

> 
> >   		sum += v1[i] + v2[i];
> >   	}
> >   	return sum;

-- 
Best regards,
Sergey Kaplun

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

end of thread, other threads:[~2026-06-09 18:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-08 10:23 [Tarantool-patches] [PATCH luajit] test: fix libfficcall compilation for old GCC Sergey Kaplun via Tarantool-patches
2026-06-09 13:55 ` Sergey Bronnikov via Tarantool-patches
2026-06-09 18:00   ` Sergey Kaplun via Tarantool-patches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox