[{"id":2027,"web_url":"https://patchwork.libcamera.org/comment/2027/","msgid":"<20190625203059.GI5002@pendragon.ideasonboard.com>","date":"2019-06-25T20:30:59","subject":"Re: [libcamera-devel] [PATCH v2] libcamera: event_dispatcher_poll:\n\tRemove struct keyword from for-range","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nThank you for the patch.\n\nOn Tue, Jun 25, 2019 at 09:27:13PM +0100, Kieran Bingham wrote:\n> When using -std=c++11, GCC versions 6.2 and 6.3 take objection to\n> declaring a struct type when using a range based iterator:\n> \n>     event_dispatcher_poll.cpp:231:13: error: types may not be defined\n> \tin a for-range-declaration [-Werror]\n> \n> \t\tfor (const struct pollfd &pfd : pollfds) {\n> \t\t           ^~~~~~\n> \n> \tcc1plus: all warnings being treated as errors\n> \n> Removing the keyword 'struct' ensures that the compiler does not try to\n> declare the type, and instead uses the type as already defined by the\n> relevant poll.h header.\n> \n> This issue does not affect later compiler versions, though earlier\n> versions do complain about this keyword if the -std=c++11 option is not\n> given.\n\nNo they don't, they complain that for range loops are a C++11 feature,\nso it's not related. I would drop the second part of the sentence.\n\n> Reported-by: [autobuild.buildroot.net] Thomas Petazzoni <thomas.petazzoni@bootlin.com>\n>   http://autobuild.buildroot.net/results/f6dd4c60c04892c8b1669e6000fce7edb2b6349e/\n> \n> Fixes: 8356f8a6ab87 (\"libcamera: Add a poll-based event dispatcher\")\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  src/libcamera/event_dispatcher_poll.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/event_dispatcher_poll.cpp b/src/libcamera/event_dispatcher_poll.cpp\n> index 0ff99fce47ab..df9dffb2326c 100644\n> --- a/src/libcamera/event_dispatcher_poll.cpp\n> +++ b/src/libcamera/event_dispatcher_poll.cpp\n> @@ -241,7 +241,7 @@ void EventDispatcherPoll::processNotifiers(const std::vector<struct pollfd> &pol\n>  \t\t{ EventNotifier::Exception, POLLPRI },\n>  \t};\n>  \n> -\tfor (const struct pollfd &pfd : pollfds) {\n> +\tfor (const pollfd &pfd : pollfds) {\n>  \t\tauto iter = notifiers_.find(pfd.fd);\n>  \t\tASSERT(iter != notifiers_.end());\n>","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 69F6C60BC7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 Jun 2019 22:33:33 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CDF21510;\n\tTue, 25 Jun 2019 22:33:32 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1561494813;\n\tbh=z+3iZeWKALtLq3guETMUXpdzt30ztlpSWfIL/Ua1SnE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=cKHOJUGEM1mjsYsn8xzr7za5Z8cQ402DtzNYWovbSR1r6t3LFbGFknk6kepLjKXXS\n\t33sWkWPp6UOo3itF1EdBnTNV0oczYfTfF3vmAW9AvNnBNk0m0YhWyjVszFgKWmcyci\n\tGl7CrJQYoDxHjarrSxioyhjnHLs73/TzY799/sR8=","Date":"Tue, 25 Jun 2019 23:30:59 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"LibCamera Devel <libcamera-devel@lists.libcamera.org>,\n\t\"[autobuild.buildroot.net] Thomas Petazzoni\"\n\t<thomas.petazzoni@bootlin.com>","Message-ID":"<20190625203059.GI5002@pendragon.ideasonboard.com>","References":"<20190625202713.10113-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190625202713.10113-1-kieran.bingham@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2] libcamera: event_dispatcher_poll:\n\tRemove struct keyword from for-range","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 25 Jun 2019 20:33:33 -0000"}}]