diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2021-06-12 10:42:52 +0200 |
---|---|---|
committer | Hans Verkuil <hans.verkuil@cisco.com> | 2021-06-12 10:42:52 +0200 |
commit | 771d9ed019c8b043d7d33db53f1ff4c5a6e52473 (patch) | |
tree | d76367f3a6e2ade9854437fd1386e03eadce6ed9 | |
parent | bfaf769fc5e607c149d3506fe7a1e6865849a05d (diff) | |
download | v4l-utils-771d9ed019c8b043d7d33db53f1ff4c5a6e52473.tar.gz |
v4l2-compliance: fix g++-7 compile error
g++ version 7 has problems with this assignment:
v4l2_ext_controls vivid_ro_ctrls = {
.which = V4L2_CTRL_WHICH_REQUEST_VAL,
.count = 1,
.controls = &vivid_ro_ctrl,
};
Probably because 'which' is part of an anonymous union.
Go back to assigning this the old fashioned way to allow
v4l2-compliance to be compiled with g++ 7.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r-- | utils/v4l2-compliance/v4l2-test-buffers.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp index 1fe1ec1c..48718656 100644 --- a/utils/v4l2-compliance/v4l2-test-buffers.cpp +++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp @@ -1953,14 +1953,18 @@ int testRequests(struct node *node, bool test_streaming) v4l2_ext_control vivid_ro_ctrl = { .id = VIVID_CID_RO_INTEGER, }; - v4l2_ext_controls vivid_ro_ctrls = { - .which = V4L2_CTRL_WHICH_REQUEST_VAL, - .count = 1, - .controls = &vivid_ro_ctrl, - }; + v4l2_ext_controls vivid_ro_ctrls = {}; bool have_controls; int ret; + // Note: trying to initialize vivid_ro_ctrls as was done for + // vivid_ro_ctrl fails with gcc 7 with this error: + // sorry, unimplemented: non-trivial designated initializers not supported + // So just set this struct the old-fashioned way. + vivid_ro_ctrls.which = V4L2_CTRL_WHICH_REQUEST_VAL; + vivid_ro_ctrls.count = 1; + vivid_ro_ctrls.controls = &vivid_ro_ctrl; + // If requests are supported, then there must be a media device if (node->buf_caps & V4L2_BUF_CAP_SUPPORTS_REQUESTS) fail_on_test(media_fd < 0); |