From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18210 invoked by alias); 19 Oct 2017 12:21:10 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 18167 invoked by uid 89); 19 Oct 2017 12:21:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=hardly X-HELO: rgout04.bt.lon5.cpcloud.co.uk Received: from rgout0405.bt.lon5.cpcloud.co.uk (HELO rgout04.bt.lon5.cpcloud.co.uk) (65.20.0.218) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Oct 2017 12:21:08 +0000 X-OWM-Source-IP: 86.179.113.201 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-RazorGate-Suspect: true Received: from localhost.localdomain (86.179.113.201) by rgout04.bt.lon5.cpcloud.co.uk (9.0.019.13-1) (authenticated as jonturney@btinternet.com) id 58482DA220BAEDD9; Thu, 19 Oct 2017 13:21:07 +0100 From: Jon Turney To: cygwin-apps@cygwin.com Cc: Jon Turney Subject: [PATCH setup 2/2] Fix -Werror=misleading-indentation errors seen with gcc 6 Date: Thu, 19 Oct 2017 12:21:00 -0000 Message-Id: <20171019122045.81736-3-jon.turney@dronecode.org.uk> In-Reply-To: <20171019122045.81736-1-jon.turney@dronecode.org.uk> References: <20171019122045.81736-1-jon.turney@dronecode.org.uk> X-SW-Source: 2017-10/txt/msg00083.txt.bz2 This looks like an actual bug which has been lurking here since forever, fortunately not exposed since hardly anything uses Option::Optional... libgetopt++/src/OptionSet.cc: In member function 'void OptionSet::doOption(std::__cxx11::string&, const size_type&)': libgetopt++/src/OptionSet.cc:125:25: error: this 'if' clause does not guard... [-Werror=misleading-indentation] if (!isOption(maybepos)) ^~ libgetopt++/src/OptionSet.cc:128:8: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' argv.erase(argv.begin() + 1); ^~~~ libgetopt++/src/OptionSet.cc:159:25: error: this 'if' clause does not guard... [-Werror=misleading-indentation] if (!isOption(maybepos)) ^~ libgetopt++/src/OptionSet.cc:161:8: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' argv.erase(argv.begin() + 1); ^~~~ --- libgetopt++/src/OptionSet.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libgetopt++/src/OptionSet.cc b/libgetopt++/src/OptionSet.cc index f57b89a..81ffeae 100644 --- a/libgetopt++/src/OptionSet.cc +++ b/libgetopt++/src/OptionSet.cc @@ -122,10 +122,11 @@ OptionSet::doOption(string &option, string::size_type const &pos) if (argv.size() > 1) { string::size_type maybepos = argv[1].find_first_not_of("-"); - if (!isOption(maybepos)) + if (!isOption(maybepos)) { /* not an option */ value = argv[1]; argv.erase(argv.begin() + 1); + } } } else { /* value if present is in this argv */ @@ -156,9 +157,10 @@ OptionSet::doOption(string &option, string::size_type const &pos) if (argv.size() > 1) { string::size_type maybepos = argv[1].find_first_not_of("-"); - if (!isOption(maybepos)) + if (!isOption(maybepos)) { value = argv[1]; argv.erase(argv.begin() + 1); + } } } } -- 2.14.2