pw_log_android: Ensure log level is expanded

This adds one more indirection to PW_HANDLE_LOG to ensure the log level
argument is expanded before used in _PW_LOG_ANDROID_LEVEL_*.

Change-Id: I76857b7f8ab7e93b3b3314df17d682c0dbb8ec38
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/100088
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Vic Yang <victoryang@google.com>
This commit is contained in:
Vic Yang 2022-07-12 14:48:00 +00:00 committed by CQ Bot Account
parent 438c2a742c
commit 3a66f45ed9

View File

@ -39,5 +39,9 @@
// #define PW_LOG_LEVEL_FATAL 7
#define _PW_LOG_ANDROID_LEVEL_7(...) LOG_ALWAYS_FATAL(__VA_ARGS__)
#define PW_HANDLE_LOG(level, flags, ...) \
#define _PW_HANDLE_LOG(level, flags, ...) \
_PW_LOG_ANDROID_LEVEL_##level(__VA_ARGS__)
// The indirection through _PW_HANDLE_LOG ensures the `level` argument is
// expanded.
#define PW_HANDLE_LOG(...) _PW_HANDLE_LOG(__VA_ARGS__)