Skip to content

Commit d1e9c49

Browse files
author
Tor Didriksen
committed
Bug#35667284 Update compiler version requirements to gcc 10 and clang 10
Reject older compilers known to break the build. Also prepare for the switch from C++17 to C++20. Change-Id: Idfccfc38c6065d09523b020e27c8061db517a849
1 parent 3daa476 commit d1e9c49

File tree

13 files changed

+30
-92
lines changed

13 files changed

+30
-92
lines changed

CMakeLists.txt

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -655,12 +655,6 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
655655
SET(MY_COMPILER_IS_CLANG 1)
656656
ELSEIF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
657657
SET(MY_COMPILER_IS_GNU 1)
658-
IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9 AND
659-
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8)
660-
SET(MY_COMPILER_IS_GNU_8 1)
661-
ENDIF()
662-
ELSEIF(CMAKE_CXX_COMPILER_ID MATCHES "SunPro")
663-
SET(MY_COMPILER_IS_SUNPRO 1)
664658
ENDIF()
665659

666660
IF(MY_COMPILER_IS_CLANG OR MY_COMPILER_IS_GNU)
@@ -797,15 +791,6 @@ OPTION(WITH_EXPERIMENTAL_CPP20
797791
"Build with -std=c++20, note: this is experimental" OFF)
798792

799793
IF(WITH_EXPERIMENTAL_CPP20)
800-
IF(MY_COMPILER_IS_GNU)
801-
IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
802-
MESSAGE(FATAL_ERROR "GCC 10 or newer is required for -std=c++20")
803-
ENDIF()
804-
ELSEIF(MY_COMPILER_IS_CLANG)
805-
IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0)
806-
MESSAGE(FATAL_ERROR "Clang 11 or newer is required for -std=c++20")
807-
ENDIF()
808-
ENDIF()
809794
IF(UNIX)
810795
STRING(REPLACE "-std=c++17" "-std=c++20"
811796
CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")

cmake/fastcov.cmake

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ IF(NOT FASTCOV_EXECUTABLE)
4444
RETURN()
4545
ENDIF()
4646

47-
IF(NOT CMAKE_COMPILER_IS_GNUCXX OR
48-
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
49-
MESSAGE(WARNING "You should upgrade to gcc version >= 9")
47+
IF(NOT CMAKE_COMPILER_IS_GNUCXX)
48+
MESSAGE(WARNING "You should upgrade to gcc version >= 10")
5049
RETURN()
5150
ENDIF()
5251

@@ -88,9 +87,9 @@ IF(CMAKE_MATCH_1)
8887
SET(GCOV_VERSION "${CMAKE_MATCH_1}")
8988
ENDIF()
9089

91-
IF(GCOV_VERSION AND GCOV_VERSION VERSION_LESS 9)
90+
IF(GCOV_VERSION AND GCOV_VERSION VERSION_LESS 10)
9291
MESSAGE(FATAL_ERROR "${GCOV_EXECUTABLE} has version ${GCOV_VERSION}\n"
93-
"At least version 9 is required")
92+
"At least version 10 is required")
9493
ENDIF()
9594

9695
IF(WITH_ROUTER)

cmake/fprofile.cmake

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,6 @@
2222

2323
# Options for doing PGO (profile guided optimization) with gcc/clang.
2424
#
25-
# gcc8 and gcc9 handle naming and location of the .gcda files
26-
# (containing profile data) completely differently, hence the slightly
27-
# different HowTos below:
28-
#
29-
# HowTo for gcc8:
30-
# Assuming we have three build directories
31-
# <some path>/build-gen
32-
# <some path>/build-use
33-
# <some path>/profile-data
34-
#
35-
# in build-gen
36-
# cmake <path to source> -DFPROFILE_GENERATE=1
37-
# make
38-
# run whatever test suite is an appropriate training set
39-
# in build-use
40-
# cmake <path to source> -DFPROFILE_USE=1
41-
# make
42-
#
4325
# HowTo for gcc9 and above:
4426
# Assuming we have two build directories
4527
# <some path>/build
@@ -82,11 +64,7 @@ IF(NOT MY_COMPILER_IS_GNU_OR_CLANG)
8264
ENDIF()
8365

8466
IF(MY_COMPILER_IS_GNU)
85-
IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
86-
SET(FPROFILE_DIR_DEFAULT "${CMAKE_BINARY_DIR}/../profile-data")
87-
ELSE()
88-
SET(FPROFILE_DIR_DEFAULT "${CMAKE_BINARY_DIR}-profile-data")
89-
ENDIF()
67+
SET(FPROFILE_DIR_DEFAULT "${CMAKE_BINARY_DIR}-profile-data")
9068
ELSE()
9169
SET(FPROFILE_DIR_DEFAULT "${CMAKE_BINARY_DIR}/../profile-data")
9270
ENDIF()
@@ -123,10 +101,8 @@ IF(FPROFILE_USE)
123101
# to be optimized as if they were compiled without profile feedback.
124102
# This leads to better performance when train run is not representative
125103
# but also leads to significantly bigger code.
126-
IF(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
127-
STRING_APPEND(CMAKE_C_FLAGS " -fprofile-partial-training")
128-
STRING_APPEND(CMAKE_CXX_FLAGS " -fprofile-partial-training")
129-
ENDIF()
104+
STRING_APPEND(CMAKE_C_FLAGS " -fprofile-partial-training")
105+
STRING_APPEND(CMAKE_CXX_FLAGS " -fprofile-partial-training")
130106

131107
ENDIF()
132108
ENDIF()

cmake/maintainer.cmake

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ IF(MY_COMPILER_IS_GNU)
6060
# This is included in -Wall on some platforms, enable it explicitly.
6161
MY_ADD_C_WARNING_FLAG("Wstringop-truncation")
6262
MY_ADD_CXX_WARNING_FLAG("Wstringop-truncation")
63-
IF(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9)
64-
# GCC 8 has bugs with "final".
65-
MY_ADD_CXX_WARNING_FLAG("Wsuggest-override")
66-
ENDIF()
63+
MY_ADD_CXX_WARNING_FLAG("Wsuggest-override")
6764
MY_ADD_C_WARNING_FLAG("Wmissing-include-dirs")
6865
MY_ADD_CXX_WARNING_FLAG("Wmissing-include-dirs")
6966

@@ -193,10 +190,9 @@ IF(MY_COMPILER_IS_GNU_OR_CLANG)
193190
ENDIF()
194191

195192
MACRO(ADD_WSHADOW_WARNING)
196-
IF(MY_COMPILER_IS_GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7)
193+
IF(MY_COMPILER_IS_GNU)
197194
ADD_COMPILE_OPTIONS("-Wshadow=local")
198-
ELSEIF(MY_COMPILER_IS_CLANG AND
199-
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 5)
195+
ELSEIF(MY_COMPILER_IS_CLANG)
200196
# added in clang-5.0
201197
ADD_COMPILE_OPTIONS("-Wshadow-uncaptured-local")
202198
ENDIF()

cmake/os/FreeBSD.cmake

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,17 @@ LIST(APPEND CMAKE_REQUIRED_INCLUDES "/usr/local/include")
3333
# in order to search include/boost_1_70_0/patches
3434
# INCLUDE_DIRECTORIES(SYSTEM /usr/local/include)
3535

36-
# We require at least Clang 6.0 (FreeBSD 12).
36+
# We require at least GCC 10 Clang 10
3737
IF(NOT FORCE_UNSUPPORTED_COMPILER)
38-
IF(MY_COMPILER_IS_CLANG)
39-
CHECK_C_SOURCE_RUNS("
40-
int main()
41-
{
42-
return (__clang_major__ < 6);
43-
}" HAVE_SUPPORTED_CLANG_VERSION)
44-
IF(NOT HAVE_SUPPORTED_CLANG_VERSION)
45-
MESSAGE(FATAL_ERROR "Clang 6.0 or newer is required!")
38+
IF(MY_COMPILER_IS_GNU)
39+
IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10)
40+
MESSAGE(FATAL_ERROR "GCC 10 or newer is required")
4641
ENDIF()
47-
ELSEIF(MY_COMPILER_IS_GNU)
48-
IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.1)
49-
MESSAGE(FATAL_ERROR "GCC 7.1 or newer is required")
42+
ELSEIF(MY_COMPILER_IS_CLANG)
43+
IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10)
44+
MESSAGE(FATAL_ERROR "Clang 10 or newer is required!")
5045
ENDIF()
5146
ELSE()
5247
MESSAGE(FATAL_ERROR "Unsupported compiler!")
5348
ENDIF()
5449
ENDIF()
55-

cmake/os/Linux.cmake

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,17 @@ IF(LINUX_FEDORA OR LINUX_RHEL OR LINUX_SUSE)
6464
SET(LINUX_RPM_PLATFORM 1)
6565
ENDIF()
6666

67-
# We require at least GCC 7.1 Clang 5
67+
# We require at least GCC 10 Clang 10
6868
IF(NOT FORCE_UNSUPPORTED_COMPILER)
6969
IF(MY_COMPILER_IS_GNU)
70-
IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.1)
71-
MESSAGE(FATAL_ERROR "GCC 7.1 or newer is required")
70+
# gcc9 is known to fail
71+
IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10)
72+
MESSAGE(FATAL_ERROR "GCC 10 or newer is required")
7273
ENDIF()
7374
ELSEIF(MY_COMPILER_IS_CLANG)
74-
IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
75-
MESSAGE(FATAL_ERROR "Clang 5 or newer is required!")
75+
# This is the lowest version tested
76+
IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10)
77+
MESSAGE(FATAL_ERROR "Clang 10 or newer is required!")
7678
ENDIF()
7779
ELSE()
7880
MESSAGE(FATAL_ERROR "Unsupported compiler!")

cmake/os/SunOS.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ STRING_APPEND(CMAKE_C_LINK_FLAGS " -m64")
4646
STRING_APPEND(CMAKE_CXX_LINK_FLAGS " -m64")
4747

4848
IF(NOT FORCE_UNSUPPORTED_COMPILER)
49-
IF(MY_COMPILER_IS_SUNPRO)
50-
MESSAGE(FATAL_ERROR "Oracle Studio is not supported.")
51-
ELSEIF(MY_COMPILER_IS_CLANG)
49+
IF(MY_COMPILER_IS_CLANG)
5250
MESSAGE(WARNING "Clang is experimental!!")
5351
ELSEIF(MY_COMPILER_IS_GNU)
5452
# 9.2.0 generated code which dumped core in optimized mode.

plugin/group_replication/libmysqlgcs/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,7 @@ IF(MYSQL_MAINTAINER_MODE)
227227
IF(MY_COMPILER_IS_CLANG)
228228
ADD_COMPILE_OPTIONS("-Wshadow")
229229
ELSEIF(MY_COMPILER_IS_GNU)
230-
# GCC's -Wshadow is too noisy. Starting with GCC 7 we can use the
231-
# more surgical -Wshadow=compatible-local
232-
IF(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
233-
ADD_COMPILE_OPTIONS("-Wshadow=compatible-local")
234-
ENDIF()
230+
ADD_COMPILE_OPTIONS("-Wshadow=compatible-local")
235231
ENDIF()
236232
ENDIF()
237233

sql/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ ADD_WSHADOW_WARNING()
2727
# Lots of warnings about -Walloc-size-larger-than= from my_malloc.cc
2828
# but it is basically impossible to trace the actual origin.
2929
IF(FPROFILE_GENERATE OR FPROFILE_USE)
30-
IF(MY_COMPILER_IS_GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
30+
IF(MY_COMPILER_IS_GNU)
3131
# -Walloc-size-larger-than=PTRDIFF_MAX is enabled by default.
3232
STRING_APPEND(CMAKE_EXE_LINKER_FLAGS " -Wno-alloc-size-larger-than")
3333
ENDIF()

storage/ndb/nodejs/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ FOREACH(warning
144144
ENDIF()
145145
ENDFOREACH()
146146

147-
IF(MY_COMPILER_IS_GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
147+
IF(MY_COMPILER_IS_GNU)
148148
# It's tricky to check alloc-size-larger-than warning in
149149
# MY_CHECK_CXX_COMPILER_WARNING(). Handle it differently
150150
# as done in sql/CMakeLists.txt

storage/ndb/src/kernel/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
# Memory allocation in NDB kernel relies on object properties that
2727
# are set before calling the object constructor.
2828
#
29-
IF(CMAKE_COMPILER_IS_GNUCXX
30-
AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "6.0.0")
29+
IF(CMAKE_COMPILER_IS_GNUCXX)
3130
STRING_APPEND(CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UPPER} " -flifetime-dse=1")
3231
ENDIF()
3332

unittest/gunit/innodb/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ INCLUDE_DIRECTORIES(
2828
INCLUDE(${CMAKE_SOURCE_DIR}/storage/innobase/innodb.cmake)
2929

3030
IF(WITH_LTO OR CMAKE_COMPILER_FLAG_WITH_LTO)
31-
IF(MY_COMPILER_IS_GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
31+
IF(MY_COMPILER_IS_GNU)
3232
# -Walloc-size-larger-than=PTRDIFF_MAX is enabled by default.
3333
STRING_APPEND(CMAKE_EXE_LINKER_FLAGS " -Wno-alloc-size-larger-than")
3434
ENDIF()

utilities/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,6 @@ IF(MY_COMPILER_IS_GNU_OR_CLANG)
165165
COMPILE_FLAGS "-Wno-unused-parameter -Wno-cast-qual")
166166
ENDIF()
167167

168-
# This compiler says -Werror=stringop-overflow= for:
169-
# memcmp(&space_id, buf.begin() + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 4)
170-
IF(MY_COMPILER_IS_GNU_8)
171-
ADD_COMPILE_FLAGS(innochecksum.cc COMPILE_FLAGS "-Wno-stringop-overflow")
172-
MY_TARGET_LINK_OPTIONS(innochecksum "-Wno-stringop-overflow")
173-
ENDIF()
174-
175168
MYSQL_ADD_EXECUTABLE(ibd2sdi
176169
ibd2sdi.cc
177170
COMPONENT Server

0 commit comments

Comments
 (0)