[libcamera-devel] [PATCH] libcamera: event_dispatcher_poll: Simplify range iterator

Kieran Bingham kieran.bingham at ideasonboard.com
Tue Jun 25 15:15:08 CEST 2019


GCCv6 and GCCv7 take objections to declaring a struct type when
using a range based iterator. This issue does not appear in GCCv8

    event_dispatcher_poll.cpp:231:13: error: types may not be defined
	in a for-range-declaration [-Werror]

		for (const struct pollfd &pfd : pollfds) {
		           ^~~~~~

	cc1plus: all warnings being treated as errors

Removing the keyword 'struct' ensures that the compiler does not try to
declare the type, and instead uses the type as already defined by the
relevant poll.h header.

Reported-by: [autobuild.buildroot.net] Thomas Petazzoni <thomas.petazzoni at bootlin.com>
Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
 src/libcamera/event_dispatcher_poll.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libcamera/event_dispatcher_poll.cpp b/src/libcamera/event_dispatcher_poll.cpp
index 0ff99fce47ab..df9dffb2326c 100644
--- a/src/libcamera/event_dispatcher_poll.cpp
+++ b/src/libcamera/event_dispatcher_poll.cpp
@@ -241,7 +241,7 @@ void EventDispatcherPoll::processNotifiers(const std::vector<struct pollfd> &pol
 		{ EventNotifier::Exception, POLLPRI },
 	};
 
-	for (const struct pollfd &pfd : pollfds) {
+	for (const pollfd &pfd : pollfds) {
 		auto iter = notifiers_.find(pfd.fd);
 		ASSERT(iter != notifiers_.end());
 
-- 
2.20.1



More information about the libcamera-devel mailing list