forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENABLE ROCKSDB - Fix clang-5+ and gcc-5+ compilation issues (facebook…
…#1076) Summary: 1. Suppress warnings only if compiler supports "-Wno-xxxxxx". 2. Fix issues described at https://jira.percona.com/browse/PS-6054 and https://jira.percona.com/browse/PS-6058 3. Fix linking issues for clang-7 and clang-8: ``` /usr/bin/ld.gold: error: /usr/lib/llvm-8/lib/clang/8.0.1/lib/linux/libclang_rt.fuzzer-x86_64.a(FuzzerDataFlowTrace.cpp.o): invalid section group 9 refers to earlier section 3 /usr/bin/ld.gold: error: /usr/lib/llvm-8/lib/clang/8.0.1/lib/linux/libclang_rt.fuzzer-x86_64.a(FuzzerDataFlowTrace.cpp.o): invalid section group 10 refers to earlier section 4 /usr/bin/ld.gold: error: /usr/lib/llvm-8/lib/clang/8.0.1/lib/linux/libclang_rt.fuzzer-x86_64.a(FuzzerDataFlowTrace.cpp.o): invalid section group 11 refers to earlier section 5 ``` 4. Fix `-Werror=ignored-qualifiers` warnings e.g. ``` /fb-8.0.17/storage/rocksdb/ha_rocksdb.cc:882:70: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers] 882 | static_cast<const rocksdb::InfoLogLevel>(rocksdb_info_log_level)); ``` 5. Fix a `-Wundefined-reinterpret-cast` warning: ``` /fb-8.0.17/storage/rocksdb/ha_rocksdb.cc:3777:11: error: dereference of type 'myrocks::Rdb_transaction **' that was reinterpret_cast from type 'void **' has undefined behavior [-Werror,-Wundefined-reinterpret-cast] return *reinterpret_cast<Rdb_transaction **>( ``` 6. Fix a `-Werror=attributes` warning: ``` /fb-8.0.17/include/my_compiler.h:100:40: error: ‘nonnull’ attribute only applies to function types [-Werror=attributes] 100 | #define MY_ATTRIBUTE(A) __attribute__(A) ``` 7. Fix ``` /fb-8.0.17/sql/dd/impl/types/schema_impl.cc:100:1: error: base class ‘class dd::Weak_object’ should be explicitly initialized in the copy constructor [-Werror=extra] Schema_impl::Schema_impl(const Schema_impl &src) ``` Pull Request resolved: facebook#1076 Reviewed By: lth Differential Revision: D19301431 Pulled By: lth fbshipit-source-id: d302e8d
- Loading branch information
Showing
13 changed files
with
149 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Copyright (c) 2017, Percona and/or its affiliates. All rights reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; version 2 of the License. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ | ||
|
||
# helper macros to prepend or append c and cxx flags if supported by compiler | ||
|
||
INCLUDE (CheckCCompilerFlag) | ||
INCLUDE (CheckCXXCompilerFlag) | ||
|
||
MACRO (prepend_cflags_if_supported) | ||
FOREACH (flag ${ARGN}) | ||
STRING (REGEX REPLACE "-" "_" temp_flag ${flag}) | ||
check_c_compiler_flag (${flag} HAVE_C_${temp_flag}) | ||
IF (HAVE_C_${temp_flag}) | ||
SET (CMAKE_C_FLAGS "${flag} ${CMAKE_C_FLAGS}") | ||
ENDIF () | ||
check_cxx_compiler_flag (${flag} HAVE_CXX_${temp_flag}) | ||
IF (HAVE_CXX_${temp_flag}) | ||
SET (CMAKE_CXX_FLAGS "${flag} ${CMAKE_CXX_FLAGS}") | ||
ENDIF () | ||
ENDFOREACH (flag) | ||
ENDMACRO (prepend_cflags_if_supported) | ||
|
||
MACRO (append_cflags_if_supported) | ||
FOREACH (flag ${ARGN}) | ||
STRING (REGEX REPLACE "-" "_" temp_flag ${flag}) | ||
check_c_compiler_flag (${flag} HAVE_C_${temp_flag}) | ||
IF (HAVE_C_${temp_flag}) | ||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}") | ||
ENDIF () | ||
check_cxx_compiler_flag (${flag} HAVE_CXX_${temp_flag}) | ||
IF (HAVE_CXX_${temp_flag}) | ||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") | ||
ENDIF () | ||
ENDFOREACH (flag) | ||
ENDMACRO (append_cflags_if_supported) | ||
|
||
MACRO (remove_compile_flags) | ||
FOREACH (flag ${ARGN}) | ||
IF(CMAKE_C_FLAGS MATCHES ${flag}) | ||
STRING(REGEX REPLACE "${flag}( |$)" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") | ||
ENDIF(CMAKE_C_FLAGS MATCHES ${flag}) | ||
IF(CMAKE_CXX_FLAGS MATCHES ${flag}) | ||
STRING(REGEX REPLACE "${flag}( |$)" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||
ENDIF(CMAKE_CXX_FLAGS MATCHES ${flag}) | ||
ENDFOREACH (flag) | ||
ENDMACRO (remove_compile_flags) | ||
|
||
## ADD_CXX_COMPILE_FLAGS_TO_FILES(<flags> FILES <source files>) | ||
## Add compile flags to given c++ files for all supported flags | ||
MACRO(ADD_CXX_COMPILE_FLAGS_TO_FILES) | ||
SET(FILES "") | ||
SET(FLAGS "") | ||
SET(FILES_SEEN) | ||
FOREACH(ARG ${ARGV}) | ||
IF("x${ARG}" STREQUAL "xFILES") | ||
SET(FILES_SEEN 1) | ||
ELSEIF(FILES_SEEN) | ||
LIST(APPEND FILES ${ARG}) | ||
ELSE() | ||
LIST(APPEND FLAGS ${ARG}) | ||
ENDIF() | ||
ENDFOREACH() | ||
SET(CHECKED_FLAGS "") | ||
FOREACH (flag ${FLAGS}) | ||
STRING (REGEX REPLACE "-" "_" temp_flag ${flag}) | ||
MY_CHECK_CXX_COMPILER_FLAG(${flag} HAVE_CXX_${temp_flag}) | ||
IF (HAVE_CXX_${temp_flag}) | ||
STRING_APPEND(CHECKED_FLAGS "${flag}") | ||
ENDIF() | ||
ENDFOREACH(flag) | ||
ADD_COMPILE_FLAGS(${FILES} COMPILE_FLAGS ${CHECKED_FLAGS}) | ||
ENDMACRO(ADD_CXX_COMPILE_FLAGS_TO_FILES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.