mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Make sure logger levels stay in sync across files
This commit is contained in:
parent
f5afc52655
commit
56432a44c6
|
@ -85,6 +85,8 @@ travis_script() {
|
|||
# Use () to run in a separate process so the exports are local.
|
||||
(run_static_analysis)
|
||||
|
||||
other/analysis/check_logger_levels
|
||||
|
||||
cmake -B_build -H. \
|
||||
-DCMAKE_C_FLAGS="$C_FLAGS" \
|
||||
-DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
|
||||
|
|
18
other/analysis/check_logger_levels
Executable file
18
other/analysis/check_logger_levels
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/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"
|
|
@ -32,6 +32,7 @@
|
|||
#define MIN_LOGGER_LEVEL LOGGER_LEVEL_INFO
|
||||
#endif
|
||||
|
||||
// NOTE: Don't forget to update build system files after modifying the enum.
|
||||
typedef enum Logger_Level {
|
||||
LOGGER_LEVEL_TRACE,
|
||||
LOGGER_LEVEL_DEBUG,
|
||||
|
|
Loading…
Reference in New Issue
Block a user