From d0f54a5cfb13e9ec437083666eb1b2cca6a39941 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Thu, 25 Jul 2013 13:24:32 -0700 Subject: [PATCH] Warn about unused RUST_LOG specs --- src/rt/rust_log.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/rt/rust_log.cpp b/src/rt/rust_log.cpp index 8179c53e96d..f7b117a8cb1 100644 --- a/src/rt/rust_log.cpp +++ b/src/rt/rust_log.cpp @@ -234,7 +234,9 @@ static void update_entry(const mod_entry* entry, void *cookie) { } } *entry->state = level; - (*args->n_matches)++; + if (longest_match > 0) { + (*args->n_matches)++; + } } void update_module_map(const mod_entry* map, log_directive* dirs, @@ -318,11 +320,10 @@ void update_log_settings(void* crate_map, char* settings) { n_dirs, &n_matches); if (n_matches < n_dirs) { - // NB: Android compiler is complaining about format specifiers here - // and I don't understand why - /*printf("warning: got %" PRIdPTR " RUST_LOG specs, " - "enabled %" PRIdPTR " flags.", - (uintptr_t)n_dirs, (uintptr_t)n_matches);*/ + fprintf(stderr, "warning: got %lu RUST_LOG specs but only matched %lu of them.\n" + "You may have mistyped a RUST_LOG spec.\n" + "Use RUST_LOG=::help to see the list of crates and modules.\n", + (unsigned long)n_dirs, (unsigned long)n_matches); } free(buffer);