From 69e4062cc7ba00c5b50628e0f60d393c3f5e92bd Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 30 Nov 2017 10:37:49 +0100 Subject: [PATCH] Remove capture_warnings.sh and print_warnings.cmake This is a separate feature, unrelated to system versioning We may keep it or not, but either way, it's a separate discussion, if we keep it, it won't be in the system versioning branch --- BUILD/capture_warnings.sh | 86 -------------------------------------- CMakeLists.txt | 2 - cmake/print_warnings.cmake | 31 -------------- 3 files changed, 119 deletions(-) delete mode 100755 BUILD/capture_warnings.sh delete mode 100644 cmake/print_warnings.cmake diff --git a/BUILD/capture_warnings.sh b/BUILD/capture_warnings.sh deleted file mode 100755 index 3413c4226ee..00000000000 --- a/BUILD/capture_warnings.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash -warn_path=$1 -warn_mode=$2 # 'late', 'early' or 'both' -shift 2 - -warn_file="$warn_path/compile.warnings" -suppress_file="$warn_path/suppress.warnings" - -# suppress_warnings: -# -# 1. treat STDIN as sequence of warnings (w) delimited by ^~~~... lines -# -# 2. sanitize each w to matchable m: -# a. ignore 'In file included from' lines; -# b. protect BRE chars; -# c. ignore text coords (NNN:NNN); -# d. convert multiline to X-delimited single line. -# -# 3. match sanitized m against X-delimited suppress.warnings: -# if match not found print w to STDOUT. - -suppress_warnings() -{ - [ -f "$suppress_file" ] || { - cat - return - } - [ -z "$suppress_file" ] && { - cat > /dev/null - return - } - local m w from - IFS="" - while read -r l - do - w="$w$l"$'\n' - - [[ $l =~ ^"In file included from " ]] && { - from=1 - continue - } - - [[ $from && $l =~ ^[[:space:]]+"from " ]] && - continue - - unset from - - if [[ $l =~ ^[[:space:]]*~*\^~*$ ]] - then - cat "$suppress_file" | tr '\n' 'X' | /bin/grep -Gq "$m" || - echo "$w" - unset m w - else - # Protect BRE metacharacters \.[*^$ - l=${l//\\/\\\\} - l=${l//./\\.} - l=${l//[/\\[} - l=${l//-/\\-} - l=${l//\*/\\*} - l=${l//^/\\^} - l=${l//\$/\\\$} - # replace text coords line:char with BRE wildcard - [[ $l =~ ^(.*:)[[:digit:]]+:[[:digit:]]+(.*)$ ]] && - l=${BASH_REMATCH[1]}[[:digit:]]\\+:[[:digit:]]\\+${BASH_REMATCH[2]} - m="$m$l"$'X' - fi - done -} - -exec 3>&1 -"$@" 2>&1 1>&3 | suppress_warnings | ( - cmderr=`cat` - - if [[ -n "$cmderr" ]]; then - if [[ "$cmderr" =~ error: ]]; then - echo "$cmderr" >&2 - exit - fi - [[ "$warn_mode" != "late" ]] && - echo "$cmderr" >&2 - [[ "$warn_mode" != "early" && "$cmderr" =~ (warning|note): ]] && - echo "$cmderr" >> "$warn_file" - fi -) - -exit ${PIPESTATUS} diff --git a/CMakeLists.txt b/CMakeLists.txt index 93ff9c81fcb..b16105a710b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -503,5 +503,3 @@ IF(NON_DISTRIBUTABLE_WARNING) MESSAGE(WARNING " You have linked MariaDB with GPLv3 libraries! You may not distribute the resulting binary. If you do, you will put yourself into a legal problem with Free Software Foundation.") ENDIF() - -INCLUDE(${CMAKE_SOURCE_DIR}/cmake/print_warnings.cmake) diff --git a/cmake/print_warnings.cmake b/cmake/print_warnings.cmake deleted file mode 100644 index 4823c372521..00000000000 --- a/cmake/print_warnings.cmake +++ /dev/null @@ -1,31 +0,0 @@ -IF(DEFINED WARN_MODE) - IF(NOT WARN_MODE STREQUAL "early" AND - NOT WARN_MODE STREQUAL "late" AND - NOT WARN_MODE STREQUAL "both") - MESSAGE(FATAL_ERROR "Unknown WARN_MODE: expected 'early', 'late' or 'both'") - ENDIF() - - SET_DIRECTORY_PROPERTIES(PROPERTIES RULE_LAUNCH_COMPILE - "bash ${CMAKE_SOURCE_DIR}/BUILD/capture_warnings.sh ${CMAKE_BINARY_DIR} ${WARN_MODE}") - SET_DIRECTORY_PROPERTIES(PROPERTY ADDITIONAL_MAKE_CLEAN_FILES - "${CMAKE_BINARY_DIR}/compile.warnings") - ADD_CUSTOM_TARGET(rm_compile.warnings ALL - COMMAND rm -f compile.warnings - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) - ADD_CUSTOM_TARGET(print_warnings ALL - COMMAND bash -c '[ -f compile.warnings ] && { echo "Warnings found:" \; cat compile.warnings \; echo "" \; } \; true' - DEPENDS mysqld rm_compile.warnings - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}") - - IF(TARGET explain_filename-t) - ADD_DEPENDENCIES(print_warnings explain_filename-t) - ENDIF() - - IF(TARGET mysql_client_test) - ADD_DEPENDENCIES(print_warnings mysql_client_test) - ENDIF() - - IF(TARGET udf_example) - ADD_DEPENDENCIES(print_warnings udf_example) - ENDIF() -ENDIF()