From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Kirill Yukhin <kyukhin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 02/10] cmake: ignore warnings on alignof() and offsetof()
Date: Sat, 30 May 2020 00:34:45 +0200 [thread overview]
Message-ID: <8a5bb207-536e-c243-794b-a1be8d5197bc@tarantool.org> (raw)
In-Reply-To: <20200529062445.5vs7tgq4yceu4hie@tarantool.org>
Hi! Thanks for the review!
On 29/05/2020 08:24, Kirill Yukhin wrote:
> Hello,
>
> On 28 май 01:32, Vladislav Shpilevoy wrote:
>> --- a/cmake/compiler.cmake
>> +++ b/cmake/compiler.cmake
>> @@ -276,11 +276,12 @@ macro(enable_tnt_compile_flags)
>> add_compile_flags("C;CXX" "-Wno-format-truncation")
>> endif()
>>
>> - if (CMAKE_COMPILER_IS_GNUCXX)
>> + if (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
>> # G++ bug. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31488
>> add_compile_flags("CXX"
>> "-Wno-invalid-offsetof"
>> )
>
> So, you're disabling the warning for clang? According to comment it
> was disabled for GCC because of bug in it. Update comment? Enable for
> clang?
I disable it for clang, because invalid-offsetof is not only
about the thing mentioned in the GCC bug (va_list, which is a
part of struct fiber, which uses offsetof via rlist). It is a
warning about offsetof used on a non-POD type. We use plenty
of non-POD offsetof, every time when use rlist and some other
data structures. Both clang++ and g++ complain about it.
Here is what I get for clang++:
tarantool/src/box/alter.cc:1148:2: error: offset of on non-standard-layout type 'typeof (*(op))' (aka 'AlterSpaceOp') [-Werror,-Winvalid-offsetof]
rlist_foreach_entry(op, &alter->ops, link)
I added a more descriptive comment:
====================
diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake
index ce3e7e506..9ad968d90 100644
--- a/cmake/compiler.cmake
+++ b/cmake/compiler.cmake
@@ -278,6 +278,11 @@ macro(enable_tnt_compile_flags)
if (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
# G++ bug. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31488
+ # Also offsetof() is widely used in Tarantool source code
+ # for classes and structs to implement intrusive lists and
+ # some other data structures. G++ and clang++ both
+ # complain about classes, having a virtual table. They
+ # complain fair, but this can't be fixed for now.
add_compile_flags("CXX"
"-Wno-invalid-offsetof"
)
next prev parent reply other threads:[~2020-05-29 22:34 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-27 23:32 [Tarantool-patches] [PATCH v2 00/10] Sanitize unaligned access Vladislav Shpilevoy
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 01/10] small: sanitized rlist and new region API Vladislav Shpilevoy
2020-05-28 20:41 ` Timur Safin
2020-05-28 22:56 ` Vladislav Shpilevoy
2020-06-08 23:01 ` Vladislav Shpilevoy
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 10/10] xrow: use unaligned store operation in xrow_to_iovec() Vladislav Shpilevoy
2020-05-28 20:20 ` Timur Safin
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 02/10] cmake: ignore warnings on alignof() and offsetof() Vladislav Shpilevoy
2020-05-28 20:18 ` Timur Safin
2020-05-29 6:24 ` Kirill Yukhin
2020-05-29 22:34 ` Vladislav Shpilevoy [this message]
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 03/10] cmake: add option ENABLE_UB_SANITIZER Vladislav Shpilevoy
2020-05-28 20:42 ` Timur Safin
2020-05-29 8:53 ` Sergey Bronnikov
2020-05-29 22:36 ` Vladislav Shpilevoy
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 04/10] crc32: align memory access Vladislav Shpilevoy
2020-05-28 20:11 ` Timur Safin
2020-05-28 23:23 ` Vladislav Shpilevoy
2020-05-28 23:32 ` Timur Safin
2020-06-08 22:33 ` Vladislav Shpilevoy
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 05/10] sql: make BtCursor's memory aligned Vladislav Shpilevoy
2020-05-28 20:20 ` Timur Safin
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 06/10] region: use aligned allocations where necessary Vladislav Shpilevoy
2020-05-28 20:35 ` Timur Safin
2020-05-28 23:07 ` Vladislav Shpilevoy
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 07/10] vinyl: align statements and bps tree extents Vladislav Shpilevoy
2020-05-28 20:38 ` Timur Safin
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 08/10] tuple: use unaligned store-load for field map Vladislav Shpilevoy
2020-05-28 20:22 ` Timur Safin
2020-05-27 23:32 ` [Tarantool-patches] [PATCH v2 09/10] port: make port_c_entry not PACKED Vladislav Shpilevoy
2020-05-28 20:42 ` Timur Safin
2020-06-03 21:27 ` [Tarantool-patches] [PATCH v2 00/10] Sanitize unaligned access Vladislav Shpilevoy
2020-06-08 22:33 ` Vladislav Shpilevoy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8a5bb207-536e-c243-794b-a1be8d5197bc@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=kyukhin@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v2 02/10] cmake: ignore warnings on alignof() and offsetof()' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox