Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH] Fix clang build (fails on -Wno-cast-function-type)
@ 2018-09-20 19:56 Alexander Turenko
  2018-09-20 20:01 ` [tarantool-patches] " Vladislav Shpilevoy
  2018-09-20 20:34 ` Kirill Yukhin
  0 siblings, 2 replies; 3+ messages in thread
From: Alexander Turenko @ 2018-09-20 19:56 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Alexander Turenko, tarantool-patches, Konstantin Osipov

The problem is that clang does not support -Wno-cast-function-type flag.
It is the regression from 8c538963a78f22746233b22648fb2aa6933dc135.

Follow up of #3685.
Fixes #3701.
---

branch: https://github.com/tarantool/tarantool/tree/Totktonada/gh-3701-fix-clang-build
issue: https://github.com/tarantool/tarantool/issues/3701

Please, check-in into 1.9 branch.

 cmake/compiler.cmake     | 10 ++++++++++
 src/CMakeLists.txt       |  8 --------
 test/unit/CMakeLists.txt |  8 --------
 3 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake
index 05d33ab48..f1a861533 100644
--- a/cmake/compiler.cmake
+++ b/cmake/compiler.cmake
@@ -95,6 +95,7 @@ check_c_compiler_flag("-Wno-varargs" CC_HAS_WNO_VARARGS)
 check_c_compiler_flag("-Wno-char-subscripts" CC_HAS_WNO_CHAR_SUBSCRIPTS)
 check_c_compiler_flag("-Wno-format-truncation" CC_HAS_WNO_FORMAT_TRUNCATION)
 check_c_compiler_flag("-Wno-implicit-fallthrough" CC_HAS_WNO_IMPLICIT_FALLTHROUGH)
+check_c_compiler_flag("-Wno-cast-function-type" CC_HAS_WNO_CAST_FUNCTION_TYPE)
 
 #
 # Perform build type specific configuration.
@@ -247,6 +248,15 @@ macro(enable_tnt_compile_flags)
         add_compile_flags("C" "-fno-gnu89-inline")
     endif()
 
+    # Suppress noise GCC 8 warnings.
+    #
+    # reflection.h casts a pointer to a member function to an another pointer
+    # to a member function to store it in a structure, but cast it back before
+    # a call. It is legal and does not lead to an undefined behaviour.
+    if (CC_HAS_WNO_CAST_FUNCTION_TYPE)
+        add_compile_flags("C;CXX" "-Wno-cast-function-type")
+    endif()
+
     add_definitions("-D__STDC_FORMAT_MACROS=1")
     add_definitions("-D__STDC_LIMIT_MACROS=1")
     add_definitions("-D__STDC_CONSTANT_MACROS=1")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2e7e1c436..b1c4cd711 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -3,14 +3,6 @@
 #
 enable_tnt_compile_flags()
 
-# Suppress noise GCC 8 warnings.
-#
-# reflection.h casts a pointer to a member function to an another pointer to a
-# member function to store it in a structure, but cast it back before a call.
-# It is legal and does not lead to an undefined behaviour.
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-cast-function-type")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-cast-function-type")
-
 include_directories(${LIBEV_INCLUDE_DIR})
 include_directories(${LIBEIO_INCLUDE_DIR})
 include_directories(${LIBCORO_INCLUDE_DIR})
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index b6ffe1cfa..943788b94 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -5,14 +5,6 @@ endif()
 file(GLOB all_sources *.c *.cc)
 set_source_files_compile_flags(${all_sources})
 
-# Suppress noise GCC 8 warnings.
-#
-# reflection.h casts a pointer to a member function to an another pointer to a
-# member function to store it in a structure, but cast it back before a call.
-# It is legal and does not lead to an undefined behaviour.
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-cast-function-type")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-cast-function-type")
-
 include_directories(${PROJECT_SOURCE_DIR}/src)
 include_directories(${PROJECT_BINARY_DIR}/src)
 include_directories(${PROJECT_SOURCE_DIR}/src/box)
-- 
2.19.0

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

* [tarantool-patches] Re: [PATCH] Fix clang build (fails on -Wno-cast-function-type)
  2018-09-20 19:56 [tarantool-patches] [PATCH] Fix clang build (fails on -Wno-cast-function-type) Alexander Turenko
@ 2018-09-20 20:01 ` Vladislav Shpilevoy
  2018-09-20 20:34 ` Kirill Yukhin
  1 sibling, 0 replies; 3+ messages in thread
From: Vladislav Shpilevoy @ 2018-09-20 20:01 UTC (permalink / raw)
  To: tarantool-patches, Alexander Turenko, Kirill Yukhin; +Cc: Konstantin Osipov

Thanks! It works for me.

On 20/09/2018 21:56, Alexander Turenko wrote:
> The problem is that clang does not support -Wno-cast-function-type flag.
> It is the regression from 8c538963a78f22746233b22648fb2aa6933dc135.
> 
> Follow up of #3685.
> Fixes #3701.
> ---
> 
> branch: https://github.com/tarantool/tarantool/tree/Totktonada/gh-3701-fix-clang-build
> issue: https://github.com/tarantool/tarantool/issues/3701
> 
> Please, check-in into 1.9 branch.
> 
>   cmake/compiler.cmake     | 10 ++++++++++
>   src/CMakeLists.txt       |  8 --------
>   test/unit/CMakeLists.txt |  8 --------
>   3 files changed, 10 insertions(+), 16 deletions(-)
> 
> diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake
> index 05d33ab48..f1a861533 100644
> --- a/cmake/compiler.cmake
> +++ b/cmake/compiler.cmake
> @@ -95,6 +95,7 @@ check_c_compiler_flag("-Wno-varargs" CC_HAS_WNO_VARARGS)
>   check_c_compiler_flag("-Wno-char-subscripts" CC_HAS_WNO_CHAR_SUBSCRIPTS)
>   check_c_compiler_flag("-Wno-format-truncation" CC_HAS_WNO_FORMAT_TRUNCATION)
>   check_c_compiler_flag("-Wno-implicit-fallthrough" CC_HAS_WNO_IMPLICIT_FALLTHROUGH)
> +check_c_compiler_flag("-Wno-cast-function-type" CC_HAS_WNO_CAST_FUNCTION_TYPE)
>   
>   #
>   # Perform build type specific configuration.
> @@ -247,6 +248,15 @@ macro(enable_tnt_compile_flags)
>           add_compile_flags("C" "-fno-gnu89-inline")
>       endif()
>   
> +    # Suppress noise GCC 8 warnings.
> +    #
> +    # reflection.h casts a pointer to a member function to an another pointer
> +    # to a member function to store it in a structure, but cast it back before
> +    # a call. It is legal and does not lead to an undefined behaviour.
> +    if (CC_HAS_WNO_CAST_FUNCTION_TYPE)
> +        add_compile_flags("C;CXX" "-Wno-cast-function-type")
> +    endif()
> +
>       add_definitions("-D__STDC_FORMAT_MACROS=1")
>       add_definitions("-D__STDC_LIMIT_MACROS=1")
>       add_definitions("-D__STDC_CONSTANT_MACROS=1")
> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
> index 2e7e1c436..b1c4cd711 100644
> --- a/src/CMakeLists.txt
> +++ b/src/CMakeLists.txt
> @@ -3,14 +3,6 @@
>   #
>   enable_tnt_compile_flags()
>   
> -# Suppress noise GCC 8 warnings.
> -#
> -# reflection.h casts a pointer to a member function to an another pointer to a
> -# member function to store it in a structure, but cast it back before a call.
> -# It is legal and does not lead to an undefined behaviour.
> -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-cast-function-type")
> -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-cast-function-type")
> -
>   include_directories(${LIBEV_INCLUDE_DIR})
>   include_directories(${LIBEIO_INCLUDE_DIR})
>   include_directories(${LIBCORO_INCLUDE_DIR})
> diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
> index b6ffe1cfa..943788b94 100644
> --- a/test/unit/CMakeLists.txt
> +++ b/test/unit/CMakeLists.txt
> @@ -5,14 +5,6 @@ endif()
>   file(GLOB all_sources *.c *.cc)
>   set_source_files_compile_flags(${all_sources})
>   
> -# Suppress noise GCC 8 warnings.
> -#
> -# reflection.h casts a pointer to a member function to an another pointer to a
> -# member function to store it in a structure, but cast it back before a call.
> -# It is legal and does not lead to an undefined behaviour.
> -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-cast-function-type")
> -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-cast-function-type")
> -
>   include_directories(${PROJECT_SOURCE_DIR}/src)
>   include_directories(${PROJECT_BINARY_DIR}/src)
>   include_directories(${PROJECT_SOURCE_DIR}/src/box)
> 

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

* [tarantool-patches] Re: [PATCH] Fix clang build (fails on -Wno-cast-function-type)
  2018-09-20 19:56 [tarantool-patches] [PATCH] Fix clang build (fails on -Wno-cast-function-type) Alexander Turenko
  2018-09-20 20:01 ` [tarantool-patches] " Vladislav Shpilevoy
@ 2018-09-20 20:34 ` Kirill Yukhin
  1 sibling, 0 replies; 3+ messages in thread
From: Kirill Yukhin @ 2018-09-20 20:34 UTC (permalink / raw)
  To: Alexander Turenko; +Cc: tarantool-patches, Konstantin Osipov

Hello,
On 20 сен 22:56, Alexander Turenko wrote:
> The problem is that clang does not support -Wno-cast-function-type flag.
> It is the regression from 8c538963a78f22746233b22648fb2aa6933dc135.
> 
> Follow up of #3685.
> Fixes #3701.
I've checked your patch into 1.9 branch.

--
Regards, Kirill Yukhin
 

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

end of thread, other threads:[~2018-09-21  3:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-20 19:56 [tarantool-patches] [PATCH] Fix clang build (fails on -Wno-cast-function-type) Alexander Turenko
2018-09-20 20:01 ` [tarantool-patches] " Vladislav Shpilevoy
2018-09-20 20:34 ` Kirill Yukhin

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