Browse Source
Remove capture_warnings.sh and print_warnings.cmake
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 branchpull/478/head
committed by
Aleksey Midenkov
3 changed files with 0 additions and 119 deletions
@ -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} |
@ -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() |
Write
Preview
Loading…
Cancel
Save
Reference in new issue