summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.travis/cmake-linux2
-rwxr-xr-xother/analysis/check_logger_levels18
-rw-r--r--toxcore/logger.h1
3 files changed, 21 insertions, 0 deletions
diff --git a/.travis/cmake-linux b/.travis/cmake-linux
index 87df3b37..5f8fcbde 100755
--- a/.travis/cmake-linux
+++ b/.travis/cmake-linux
@@ -85,6 +85,8 @@ travis_script() {
85 # Use () to run in a separate process so the exports are local. 85 # Use () to run in a separate process so the exports are local.
86 (run_static_analysis) 86 (run_static_analysis)
87 87
88 other/analysis/check_logger_levels
89
88 cmake -B_build -H. \ 90 cmake -B_build -H. \
89 -DCMAKE_C_FLAGS="$C_FLAGS" \ 91 -DCMAKE_C_FLAGS="$C_FLAGS" \
90 -DCMAKE_CXX_FLAGS="$CXX_FLAGS" \ 92 -DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
diff --git a/other/analysis/check_logger_levels b/other/analysis/check_logger_levels
new file mode 100755
index 00000000..5cced4a1
--- /dev/null
+++ b/other/analysis/check_logger_levels
@@ -0,0 +1,18 @@
1#!/bin/sh
2
3# Make sure that logger levels in toxcore/logger.h, CMakeLists.txt and
4# configure.ac stay in sync.
5
6set -ex
7
8TMP_DIR="$(mktemp -d)"
9
10# ^\s+LOGGER_LEVEL_(\w+),?$
11sed -n 's/^\s\+LOGGER_LEVEL_\(\w\+\),\?$/\1/p' toxcore/logger.h > "${TMP_DIR}/logger.h"
12# ^.*\$\{MIN_LOGGER_LEVEL\}" STREQUAL "(\w+)".*$
13sed -n 's/^.*\${MIN_LOGGER_LEVEL}\" STREQUAL \"\(\w\+\)\".*$/\1/p' CMakeLists.txt > "${TMP_DIR}/CMakeLists.txt"
14# ^.*LOGGER_LEVEL_(\w+).*$
15sed -n 's/^.*LOGGER_LEVEL_\(\w\+\).*$/\1/p' configure.ac > "${TMP_DIR}/configure.ac"
16
17diff -u "${TMP_DIR}/CMakeLists.txt" "${TMP_DIR}/logger.h"
18diff -u "${TMP_DIR}/configure.ac" "${TMP_DIR}/logger.h"
diff --git a/toxcore/logger.h b/toxcore/logger.h
index 6231ca4b..2cae7a0e 100644
--- a/toxcore/logger.h
+++ b/toxcore/logger.h
@@ -32,6 +32,7 @@
32#define MIN_LOGGER_LEVEL LOGGER_LEVEL_INFO 32#define MIN_LOGGER_LEVEL LOGGER_LEVEL_INFO
33#endif 33#endif
34 34
35// NOTE: Don't forget to update build system files after modifying the enum.
35typedef enum Logger_Level { 36typedef enum Logger_Level {
36 LOGGER_LEVEL_TRACE, 37 LOGGER_LEVEL_TRACE,
37 LOGGER_LEVEL_DEBUG, 38 LOGGER_LEVEL_DEBUG,