From 0a1c72f32cd709972d6e4e5591dfd05d91edc8e1 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 11 May 2012 09:49:05 +0200 Subject: Avoid unused variable warning for empty option classes --- cli/source.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'cli') diff --git a/cli/source.cxx b/cli/source.cxx index d49caf8..2b976d4 100644 --- a/cli/source.cxx +++ b/cli/source.cxx @@ -612,10 +612,6 @@ namespace { bool b (hb && !options.exclude_base ()); - os << "void " << name << "::" << endl - << "print_usage (::std::ostream&" << (ho || b ? " os" : "") << ")" - << "{"; - // Calculate option length. // size_t len (0); @@ -676,7 +672,7 @@ namespace } } - if (max != 0) + if (len != 0 && max != 0) { if (len > max) { @@ -690,6 +686,12 @@ namespace } } + // If len is 0 then it means we have no options to print. + // + os << "void " << name << "::" << endl + << "print_usage (::std::ostream&" << (len != 0 || b ? " os)" : ")") + << "{"; + // Call our bases. // if (b) -- cgit v1.1