2018-06-24 16:41:58 +02:00
|
|
|
#!/usr/bin/env bash
|
2018-04-08 11:03:56 +02:00
|
|
|
#
|
|
|
|
# Copyright (c) 2018 The Bitcoin Core developers
|
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#
|
|
|
|
# Check that all logs are terminated with '\n'
|
|
|
|
#
|
|
|
|
# Some logs are continued over multiple lines. They should be explicitly
|
2020-07-29 13:50:36 +02:00
|
|
|
# commented with /* Continued */
|
2018-04-08 11:03:56 +02:00
|
|
|
#
|
|
|
|
# There are some instances of LogPrintf() in comments. Those can be
|
|
|
|
# ignored
|
|
|
|
|
2018-06-18 13:12:07 +02:00
|
|
|
export LC_ALL=C
|
2018-05-02 15:56:30 +02:00
|
|
|
|
|
|
|
UNTERMINATED_LOGS=$(git grep --extended-regexp "LogPrintf?\(" -- "*.cpp" | \
|
2018-04-08 11:03:56 +02:00
|
|
|
grep -v '\\n"' | \
|
|
|
|
grep -v "/\* Continued \*/" | \
|
2018-05-02 15:56:30 +02:00
|
|
|
grep -v "LogPrint()" | \
|
2018-04-08 11:03:56 +02:00
|
|
|
grep -v "LogPrintf()")
|
|
|
|
if [[ ${UNTERMINATED_LOGS} != "" ]]; then
|
2018-05-02 15:56:30 +02:00
|
|
|
echo "All calls to LogPrintf() and LogPrint() should be terminated with \\n"
|
2018-04-08 11:03:56 +02:00
|
|
|
echo
|
|
|
|
echo "${UNTERMINATED_LOGS}"
|
|
|
|
exit 1
|
|
|
|
fi
|