From 2f41b2de42c77b8f44048295a8a3f794711cd4df Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 16 May 2013 06:50:47 -0700 Subject: [PATCH] Silence errors by default with --list-all When listing all packages, the purpose is to get a quick look at what's installed and not to scrutinize the validity of each .pc file. To see errors from the parser during --list-all, the user can just add --print-errors. --- check/check-debug | 4 ++-- main.c | 31 ++++++++++++++++--------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/check/check-debug b/check/check-debug index 5ee95f2..01ac795 100755 --- a/check/check-debug +++ b/check/check-debug @@ -11,12 +11,12 @@ RESULT="PKG_CONFIG_DEBUG_SPEW variable enabling debug spew Adding directory '$srcdir' from PKG_CONFIG_PATH Global variable definition 'pc_sysrootdir' = '/' Global variable definition 'pc_top_builddir' = '\$(top_builddir)' -Error printing enabled by default due to use of output options besides --exists or --atleast/exact/max-version. Value of --silence-errors: 0 +Error printing enabled by default due to use of output options besides --exists, --atleast/exact/max-version or --list-all. Value of --silence-errors: 0 Error printing enabled $PACKAGE_VERSION" PKG_CONFIG_DEBUG_SPEW=1 run_test --version -RESULT="Error printing enabled by default due to use of output options besides --exists or --atleast/exact/max-version. Value of --silence-errors: 0 +RESULT="Error printing enabled by default due to use of output options besides --exists, --atleast/exact/max-version or --list-all. Value of --silence-errors: 0 Error printing enabled $PACKAGE_VERSION" run_test --debug --version diff --git a/main.c b/main.c index 8991479..f0f2762 100644 --- a/main.c +++ b/main.c @@ -571,16 +571,26 @@ main (int argc, char **argv) } /* Error printing is determined as follows: - * - for all output options besides --exists and --*-version, - * it's on by default and --silence-errors can turn it off - * - for --exists, --*-version, etc. and no options at all, + * - for --exists, --*-version, --list-all and no options at all, * it's off by default and --print-errors will turn it on + * - for all other output options, it's on by default and + * --silence-errors can turn it off */ - if (!want_exists) + if (want_exists || want_list) + { + debug_spew ("Error printing disabled by default due to use of output " + "options --exists, --atleast/exact/max-version, " + "--list-all or no output option at all. Value of " + "--print-errors: %d\n", + want_verbose_errors); + + /* Leave want_verbose_errors unchanged, reflecting --print-errors */ + } + else { debug_spew ("Error printing enabled by default due to use of output " - "options besides --exists or --atleast/exact/max-version. " - "Value of --silence-errors: %d\n", + "options besides --exists, --atleast/exact/max-version or " + "--list-all. Value of --silence-errors: %d\n", want_silence_errors); if (want_silence_errors && getenv ("PKG_CONFIG_DEBUG_SPEW") == NULL) @@ -588,15 +598,6 @@ main (int argc, char **argv) else want_verbose_errors = TRUE; } - else - { - debug_spew ("Error printing disabled by default due to use of output " - "options --exists, --atleast/exact/max-version or no " - "output option at all. Value of --print-errors: %d\n", - want_verbose_errors); - - /* Leave want_verbose_errors unchanged, reflecting --print-errors */ - } if (want_verbose_errors) debug_spew ("Error printing enabled\n");