mirror of
https://github.com/MariaDB/server.git
synced 2025-11-30 05:23:50 +03:00
Scripts: Three modes of warning printing.
WARN_MODE=early print warnings at compilation stage WARN_MODE=late print warnings at build finish stage WARN_MODE=both print both at early and at later stages
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
warn_path=$1
|
warn_path=$1
|
||||||
shift
|
warn_mode=$2
|
||||||
|
shift 2
|
||||||
|
|
||||||
warn_file="$warn_path/compile.warnings"
|
warn_file="$warn_path/compile.warnings"
|
||||||
suppress_file="$warn_path/suppress.warnings"
|
suppress_file="$warn_path/suppress.warnings"
|
||||||
|
|
||||||
@@ -10,7 +11,8 @@ cmderr=$("$@" 2>&1 1>&3)
|
|||||||
error=$?
|
error=$?
|
||||||
|
|
||||||
if [[ -n "$cmderr" ]]; then
|
if [[ -n "$cmderr" ]]; then
|
||||||
echo "$cmderr" >&2
|
[[ "$warn_mode" == "both" ]] &&
|
||||||
|
echo "$cmderr" >&2
|
||||||
[[ "$cmderr" =~ warning:(.+)$ ]] &&
|
[[ "$cmderr" =~ warning:(.+)$ ]] &&
|
||||||
echo -n "$cmderr" >> "$warn_file"
|
echo -n "$cmderr" >> "$warn_file"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,6 +1,20 @@
|
|||||||
IF (NOT DEFINED WITHOUT_REPRINT AND CMAKE_BUILD_TYPE MATCHES "Debug")
|
IF(NOT DEFINED WARN_MODE)
|
||||||
|
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||||
|
SET(WARN_MODE "late")
|
||||||
|
ELSE()
|
||||||
|
SET(WARN_MODE "early")
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
IF(NOT WARN_MODE MATCHES "early")
|
||||||
SET_DIRECTORY_PROPERTIES(PROPERTIES RULE_LAUNCH_COMPILE
|
SET_DIRECTORY_PROPERTIES(PROPERTIES RULE_LAUNCH_COMPILE
|
||||||
"bash ${CMAKE_SOURCE_DIR}/BUILD/capture_warnings.sh ${CMAKE_BINARY_DIR}")
|
"bash ${CMAKE_SOURCE_DIR}/BUILD/capture_warnings.sh ${CMAKE_BINARY_DIR} ${WARN_MODE}")
|
||||||
SET_DIRECTORY_PROPERTIES(PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
|
SET_DIRECTORY_PROPERTIES(PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
|
||||||
"${CMAKE_BINARY_DIR}/compile.warnings")
|
"${CMAKE_BINARY_DIR}/compile.warnings")
|
||||||
ADD_CUSTOM_TARGET(rm_compile.warnings ALL
|
ADD_CUSTOM_TARGET(rm_compile.warnings ALL
|
||||||
|
|||||||
Reference in New Issue
Block a user