Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH v1 1/1] box: fix compilation with old gcc
@ 2019-09-09 15:11 Kirill Shcherbatov
  2019-09-12 20:02 ` [tarantool-patches] " Alexander Turenko
  2019-09-13  8:08 ` Kirill Yukhin
  0 siblings, 2 replies; 3+ messages in thread
From: Kirill Shcherbatov @ 2019-09-09 15:11 UTC (permalink / raw)
  To: tarantool-patches, alexander.turenko; +Cc: Kirill Shcherbatov

LTO build fails on warning message:
In file included from /tarantool/src/lib/core/diag.h:33:0,
                 from /tarantool/src/box/engine.h:36,
                 from /tarantool/src/box/memtx_engine.h:40,
                 from /tarantool/src/box/memtx_engine.c:31:
/tarantool/src/box/memtx_engine.c: In function
'metmx_tuple_chunk_delete':
/tarantool/src/trivia/util.h:201:49: error: initialization from
incompatible pointer type [-Werror]
  const typeof( ((type *)0)->member  ) *__mptr = (ptr); \
                                                 ^
/tarantool/src/box/memtx_engine.c:1115:3: note: in expansion of macro
'container_of'
   container_of((typeof(tuple_chunk->data) *)data,
   ^
/tarantool/src/trivia/util.h:201:49: error: (near initialization for
'tuple_chunk') [-Werror]
  const typeof( ((type *)0)->member  ) *__mptr = (ptr); \
                                                 ^
/tarantool/src/box/memtx_engine.c:1115:3: note: in expansion of macro
'container_of'
   container_of((typeof(tuple_chunk->data) *)data,
---
 src/box/memtx_engine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/box/memtx_engine.c b/src/box/memtx_engine.c
index f6a33282c..6a6cc584f 100644
--- a/src/box/memtx_engine.c
+++ b/src/box/memtx_engine.c
@@ -1112,7 +1112,7 @@ metmx_tuple_chunk_delete(struct tuple_format *format, const char *data)
 {
 	struct memtx_engine *memtx = (struct memtx_engine *)format->engine;
 	struct tuple_chunk *tuple_chunk =
-		container_of((typeof(tuple_chunk->data) *)data,
+		container_of((const char (*)[0])data,
 			     struct tuple_chunk, data);
 	uint32_t sz = tuple_chunk_sz(tuple_chunk->data_sz);
 	smfree(&memtx->alloc, tuple_chunk, sz);
-- 
2.23.0

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

* [tarantool-patches] Re: [PATCH v1 1/1] box: fix compilation with old gcc
  2019-09-09 15:11 [tarantool-patches] [PATCH v1 1/1] box: fix compilation with old gcc Kirill Shcherbatov
@ 2019-09-12 20:02 ` Alexander Turenko
  2019-09-13  8:08 ` Kirill Yukhin
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Turenko @ 2019-09-12 20:02 UTC (permalink / raw)
  To: Kirill Shcherbatov
  Cc: tarantool-patches, Kirill Yukhin, Alexander V. Tikhonov

I have no objections, the commit looks safe. LGTM.

However I pushed the same commit to
kshch/gh-4438-gcc-4-build-fixup-full-ci to test on all targets just in
case. All CI jobs are green.

CCed Kirill Yukhin to push.

CCed Alexander Tikhonov to elaborate whether we can protect ourself from
such mistakes in the future.

issue: https://github.com/tarantool/tarantool/issues/4438
branch: https://github.com/tarantool/tarantool/tree/kshch/gh-4438-gcc-4-build-fixup

WBR, Alexander Turenko.

On Mon, Sep 09, 2019 at 06:11:46PM +0300, Kirill Shcherbatov wrote:
> LTO build fails on warning message:

Usual Debug build fails too with gcc-4.8.5.

> In file included from /tarantool/src/lib/core/diag.h:33:0,
>                  from /tarantool/src/box/engine.h:36,
>                  from /tarantool/src/box/memtx_engine.h:40,
>                  from /tarantool/src/box/memtx_engine.c:31:
> /tarantool/src/box/memtx_engine.c: In function
> 'metmx_tuple_chunk_delete':
> /tarantool/src/trivia/util.h:201:49: error: initialization from
> incompatible pointer type [-Werror]
>   const typeof( ((type *)0)->member  ) *__mptr = (ptr); \
>                                                  ^
> /tarantool/src/box/memtx_engine.c:1115:3: note: in expansion of macro
> 'container_of'
>    container_of((typeof(tuple_chunk->data) *)data,
>    ^
> /tarantool/src/trivia/util.h:201:49: error: (near initialization for
> 'tuple_chunk') [-Werror]
>   const typeof( ((type *)0)->member  ) *__mptr = (ptr); \
>                                                  ^
> /tarantool/src/box/memtx_engine.c:1115:3: note: in expansion of macro
> 'container_of'
>    container_of((typeof(tuple_chunk->data) *)data,

As I see you already added the issue number here (on the branch
kshch/gh-4438-gcc-4-build-fixup), that is good.

> ---
>  src/box/memtx_engine.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/box/memtx_engine.c b/src/box/memtx_engine.c
> index f6a33282c..6a6cc584f 100644
> --- a/src/box/memtx_engine.c
> +++ b/src/box/memtx_engine.c
> @@ -1112,7 +1112,7 @@ metmx_tuple_chunk_delete(struct tuple_format *format, const char *data)
>  {
>  	struct memtx_engine *memtx = (struct memtx_engine *)format->engine;
>  	struct tuple_chunk *tuple_chunk =
> -		container_of((typeof(tuple_chunk->data) *)data,
> +		container_of((const char (*)[0])data,
>  			     struct tuple_chunk, data);
>  	uint32_t sz = tuple_chunk_sz(tuple_chunk->data_sz);
>  	smfree(&memtx->alloc, tuple_chunk, sz);
> -- 
> 2.23.0
> 

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

* [tarantool-patches] Re: [PATCH v1 1/1] box: fix compilation with old gcc
  2019-09-09 15:11 [tarantool-patches] [PATCH v1 1/1] box: fix compilation with old gcc Kirill Shcherbatov
  2019-09-12 20:02 ` [tarantool-patches] " Alexander Turenko
@ 2019-09-13  8:08 ` Kirill Yukhin
  1 sibling, 0 replies; 3+ messages in thread
From: Kirill Yukhin @ 2019-09-13  8:08 UTC (permalink / raw)
  To: tarantool-patches; +Cc: alexander.turenko, Kirill Shcherbatov

Hello,

On 09 Sep 18:11, Kirill Shcherbatov wrote:
> LTO build fails on warning message:
> In file included from /tarantool/src/lib/core/diag.h:33:0,
>                  from /tarantool/src/box/engine.h:36,
>                  from /tarantool/src/box/memtx_engine.h:40,
>                  from /tarantool/src/box/memtx_engine.c:31:
> /tarantool/src/box/memtx_engine.c: In function
> 'metmx_tuple_chunk_delete':
> /tarantool/src/trivia/util.h:201:49: error: initialization from
> incompatible pointer type [-Werror]
>   const typeof( ((type *)0)->member  ) *__mptr = (ptr); \
>                                                  ^
> /tarantool/src/box/memtx_engine.c:1115:3: note: in expansion of macro
> 'container_of'
>    container_of((typeof(tuple_chunk->data) *)data,
>    ^
> /tarantool/src/trivia/util.h:201:49: error: (near initialization for
> 'tuple_chunk') [-Werror]
>   const typeof( ((type *)0)->member  ) *__mptr = (ptr); \
>                                                  ^
> /tarantool/src/box/memtx_engine.c:1115:3: note: in expansion of macro
> 'container_of'
>    container_of((typeof(tuple_chunk->data) *)data,

I've checked your patch into 2.2 and master.

--
Regards, Kirill Yukhin

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

end of thread, other threads:[~2019-09-13  8:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-09 15:11 [tarantool-patches] [PATCH v1 1/1] box: fix compilation with old gcc Kirill Shcherbatov
2019-09-12 20:02 ` [tarantool-patches] " Alexander Turenko
2019-09-13  8:08 ` Kirill Yukhin

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