tomato/other/analysis/check_logger_levels
Green Sky 227425b90e Squashed 'external/toxcore/c-toxcore/' content from commit 67badf69
git-subtree-dir: external/toxcore/c-toxcore
git-subtree-split: 67badf69416a74e74f6d7eb51dd96f37282b8455
2023-07-25 11:53:09 +02:00

19 lines
649 B
Bash
Executable File

#!/bin/sh
# Make sure that logger levels in toxcore/logger.h, CMakeLists.txt and
# configure.ac stay in sync.
set -ex
TMP_DIR="$(mktemp -d)"
# ^\s+LOGGER_LEVEL_(\w+),?$
sed -n 's/^\s\+LOGGER_LEVEL_\(\w\+\),\?$/\1/p' toxcore/logger.h > "${TMP_DIR}/logger.h"
# ^.*\$\{MIN_LOGGER_LEVEL\}" STREQUAL "(\w+)".*$
sed -n 's/^.*\${MIN_LOGGER_LEVEL}\" STREQUAL \"\(\w\+\)\".*$/\1/p' CMakeLists.txt > "${TMP_DIR}/CMakeLists.txt"
# ^.*LOGGER_LEVEL_(\w+).*$
sed -n 's/^.*LOGGER_LEVEL_\(\w\+\).*$/\1/p' configure.ac > "${TMP_DIR}/configure.ac"
diff -u "${TMP_DIR}/CMakeLists.txt" "${TMP_DIR}/logger.h"
diff -u "${TMP_DIR}/configure.ac" "${TMP_DIR}/logger.h"