From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp44.i.mail.ru (smtp44.i.mail.ru [94.100.177.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 088F9469710 for ; Thu, 28 May 2020 23:18:37 +0300 (MSK) From: "Timur Safin" References: In-Reply-To: Date: Thu, 28 May 2020 23:18:34 +0300 Message-ID: <048a01d6352d$2a01cd90$7e0568b0$@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Language: ru Subject: Re: [Tarantool-patches] [PATCH v2 02/10] cmake: ignore warnings on alignof() and offsetof() List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'Vladislav Shpilevoy' , tarantool-patches@dev.tarantool.org, alyapunov@tarantool.org, korablev@tarantool.org Nice, LGTM : -----Original Message----- : From: Vladislav Shpilevoy : Sent: Thursday, May 28, 2020 2:32 AM : To: tarantool-patches@dev.tarantool.org; alyapunov@tarantool.org; : korablev@tarantool.org; tsafin@tarantool.org : Subject: [PATCH v2 02/10] cmake: ignore warnings on alignof() and : offsetof() : : Warning about invalid offsetof() (used on non-POD types) was set : for g++, but wasn't for clang++. : : Warning about invalid alignof() (when expression is passed to it : instead of a type) wasn't ignored, but is going to be very : useful in upcoming unaligned memory access patches. That allows : to write something like: : : struct some_long_type *object = region_aligned_alloc( : region, size, alignof(*object)); : : This will work even if type of 'object' will change in future, : and so it is safer. And shorter. : : Part of #4609 : --- : cmake/compiler.cmake | 3 ++- : 1 file changed, 2 insertions(+), 1 deletion(-) : : diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake : index 56429dc20..ce3e7e506 100644 : --- 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" : ) : + add_compile_flags("C;CXX" "-Wno-gnu-alignof-expression") : endif() : : if (CMAKE_COMPILER_IS_GNUCC) : -- : 2.21.1 (Apple Git-122.3)