qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfio: Include libgen.h for basename API
@ 2023-12-12  0:59 Khem Raj
  0 siblings, 0 replies; only message in thread
From: Khem Raj @ 2023-12-12  0:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Khem Raj

Glibc has two implementation one based on POSIX which is used when
libgen.h is included and second implementation is GNU implementation
which is used when string.h is included. The functions are no identical
in behavior. Musl C library does not implement the GNU version, but it
has provided a declaration in string.h but this has been corrected in
latest musl [1] which exposes places where it was being used from
string.h to error out especially when -Wimplicit-function-declaration is
treated as error.

| ../qemu-8.1.2/hw/vfio/pci.c:3030:18: error: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
|  3030 |     group_name = basename(group_path);

clang-17 treats this warning as error by default

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 hw/vfio/pci.c      | 1 +
 hw/vfio/platform.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index c62c02f7b6..f043c93b9e 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -19,6 +19,7 @@
  */
 
 #include "qemu/osdep.h"
+#include <libgen.h>
 #include <linux/vfio.h>
 #include <sys/ioctl.h>
 
diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c
index 8e3d4ac458..a835ab03be 100644
--- a/hw/vfio/platform.c
+++ b/hw/vfio/platform.c
@@ -16,6 +16,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include <libgen.h>
 #include <sys/ioctl.h>
 #include <linux/vfio.h>
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-12-12  1:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-12  0:59 [PATCH] vfio: Include libgen.h for basename API Khem Raj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).