Skip to content

Commit

Permalink
PS-9188: Fix clang-18 compilation issues
Browse files Browse the repository at this point in the history
1. Boost issues:
```
In file included from /data/mysql-server/percona-8.0/sql/gis/line_interpolate.cc:29:
In file included from /data/mysql-server/_deps/boost_1_77_0/boost/geometry.hpp:17:
In file included from /data/mysql-server/_deps/boost_1_77_0/boost/geometry/geometry.hpp:53:
In file included from /data/mysql-server/_deps/boost_1_77_0/boost/geometry/core/radian_access.hpp:26:
In file included from /data/mysql-server/_deps/boost_1_77_0/boost/numeric/conversion/cast.hpp:33:
In file included from /data/mysql-server/_deps/boost_1_77_0/boost/numeric/conversion/converter.hpp:13:
In file included from /data/mysql-server/_deps/boost_1_77_0/boost/numeric/conversion/conversion_traits.hpp:13:
In file included from /data/mysql-server/_deps/boost_1_77_0/boost/numeric/conversion/detail/conversion_traits.hpp:18:
In file included from /data/mysql-server/_deps/boost_1_77_0/boost/numeric/conversion/detail/int_float_mixture.hpp:19:
In file included from /data/mysql-server/_deps/boost_1_77_0/boost/mpl/integral_c.hpp:32:
/data/mysql-server/_deps/boost_1_77_0/boost/mpl/aux_/integral_wrapper.hpp:73:31: error: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'udt_builtin_mixture_enum' [-Wenum-constexpr-conversion]
   73 |     typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior;
      |                               ^
/data/mysql-server/_deps/boost_1_77_0/boost/mpl/aux_/static_cast.hpp:24:47: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST'
   24 | #   define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr)
      |
```

2. Issues with stdc++ library from gcc-13:

```
In file included from /data/mysql-server/percona-8.0/libbinlogevents/src/compression/none_comp.cpp:23:
In file included from /data/mysql-server/percona-8.0/libbinlogevents/include/compression/none_comp.h:26:
In file included from /data/mysql-server/percona-8.0/libbinlogevents/include/compression/compressor.h:27:
In file included from /data/mysql-server/percona-8.0/libbinlogevents/include/compression/base.h:26:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/string:54:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:39:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/ext/alloc_traits.h:34:
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:266:8: error: 'construct<mysqlns::buffer::Buffer_view<>, mysqlns::buffer::Buffer_view<>>' is deprecated: std::allocator::construct is deprecated in C++17 [-Werror,-Wdeprecated-declarations]
  266 |         { __a.construct(__p, std::forward<_Args>(__args)...); }
      |               ^
/data/mysql-server/percona-8.0/libbinlogevents/include/resource/allocator.h:139:5: note: 'construct<mysqlns::buffer::Buffer_view<>, mysqlns::buffer::Buffer_view<>>' has been explicitly marked deprecated here
  139 |   [[deprecated("std::allocator::construct is deprecated in C++17")]] void
      |     ^
```
  • Loading branch information
inikep committed Apr 17, 2024
1 parent a4d64d0 commit 310ccc7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmake/maintainer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ IF(MY_COMPILER_IS_CLANG)
STRING_APPEND(MY_CXX_WARNING_FLAGS " -Wno-shorten-64-to-32")
ENDIF()

# Suppress warnings for clang-18 or newer
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
STRING_APPEND(MY_CXX_WARNING_FLAGS " -Wno-deprecated-declarations")
ENDIF()

STRING_APPEND(MY_CXX_WARNING_FLAGS " -Wextra-semi")
STRING_APPEND(MY_CXX_WARNING_FLAGS " -Wheader-hygiene")
STRING_APPEND(MY_CXX_WARNING_FLAGS " -Wnon-virtual-dtor")
Expand Down
5 changes: 5 additions & 0 deletions sql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,11 @@ ADD_DEPENDENCIES(sql_gis GenError)
TARGET_LINK_LIBRARIES(sql_gis sql_dd sql_main)
SET_TARGET_PROPERTIES(sql_gis PROPERTIES LINK_INTERFACE_MULTIPLICITY 3)

# Suppress warnings for clang-18 or newer
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
TARGET_COMPILE_OPTIONS(sql_gis PRIVATE -Wno-enum-constexpr-conversion)
ENDIF()

# This typically saves a few hundred megabytes of disk space.
IF(COMPRESS_DEBUG_SECTIONS)
MY_CHECK_CXX_COMPILER_FLAG("-gz" HAVE_COMPRESS_GZ_OPTION)
Expand Down

0 comments on commit 310ccc7

Please sign in to comment.