In some cases e.g. with clang on fedora 30 __open2 isn't even declared
which results in the following build error:
/home/pipo/libvirt/tests/virpcimock.c:939:1: error: no previous prototype for function
'__open_2' [-Werror,-Wmissing-prototypes]
__open_2(const char *path, int flags)
Add a separate declaration to appease the compiler.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
tests/virpcimock.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 829d61cd3f..cfe91ba3ff 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -935,6 +935,11 @@ open(const char *path, int flags, ...)
}
+/* in some cases this function may not be present in headers, so we need
+ * a declaration to silence the complier */
+int
+__open_2(const char *path, int flags);
+
int
__open_2(const char *path, int flags)
{
--
2.21.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Fri, Aug 16, 2019 at 09:43:27AM +0200, Peter Krempa wrote: > In some cases e.g. with clang on fedora 30 __open2 isn't even declared > which results in the following build error: > > /home/pipo/libvirt/tests/virpcimock.c:939:1: error: no previous prototype for function > '__open_2' [-Werror,-Wmissing-prototypes] > __open_2(const char *path, int flags) > > Add a separate declaration to appease the compiler. > > Signed-off-by: Peter Krempa <pkrempa@redhat.com> > --- I guess you could have simply pushed this as a build breaker, anyway: Reviewed-by: Erik Skultety <eskultet@redhat.com> -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Fri, Aug 16, 2019 at 09:52:02 +0200, Erik Skultety wrote: > On Fri, Aug 16, 2019 at 09:43:27AM +0200, Peter Krempa wrote: > > In some cases e.g. with clang on fedora 30 __open2 isn't even declared > > which results in the following build error: > > > > /home/pipo/libvirt/tests/virpcimock.c:939:1: error: no previous prototype for function > > '__open_2' [-Werror,-Wmissing-prototypes] > > __open_2(const char *path, int flags) > > > > Add a separate declaration to appease the compiler. > > > > Signed-off-by: Peter Krempa <pkrempa@redhat.com> > > --- > I guess you could have simply pushed this as a build breaker, anyway: I find this solution kind of ugly, that's why I wasn't completely persuaded to push it right away. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2024 Red Hat, Inc.