Skip to contentSkip to conversation

Remove several implicit function declarations

PATCH RESEND In review Arjun Shankar 1 participant 2 messages Feb 27, 2023

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/1 Remove several implicit function declarations

During configure, several ioctl checks omit the corresponding include and a pwritev2 check uses the wrong feature test macro. This commit fixes the same.

---
We ran into these when trying to port Fedora to modern C:

https://fedoraproject.org/wiki/Changes/PortingToModernC
https://fedoraproject.org/wiki/Toolchain/PortingToModernC

v2 notes: Removed the changes to unicrash.c;
it was already fixed by 5ead2de386d879

---
 m4/package_libcdev.m4 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
m4/package_libcdev.m4 +5 -2
index bb1ab49c..f987aa4a 100644
@@ -117,6 +117,7 @@ AC_DEFUN([AC_HAVE_FIEMAP],
 #define _GNU_SOURCE
 #include <linux/fs.h>
 #include <linux/fiemap.h>
+#include <sys/ioctl.h>
 	]], [[
 struct fiemap *fiemap;
 ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
@@ -153,7 +154,7 @@ AC_DEFUN([AC_HAVE_PWRITEV2],
   [ AC_MSG_CHECKING([for pwritev2])
     AC_LINK_IFELSE(
     [	AC_LANG_PROGRAM([[
-#define _BSD_SOURCE
+#define _GNU_SOURCE
 #include <sys/uio.h>
 	]], [[
 pwritev2(0, 0, 0, 0, 0);
@@ -454,6 +455,7 @@ AC_DEFUN([AC_HAVE_SG_IO],
     AC_COMPILE_IFELSE(
     [	AC_LANG_PROGRAM([[
 #include <scsi/sg.h>
+#include <sys/ioctl.h>
 	]], [[
 struct sg_io_hdr hdr;
 ioctl(0, SG_IO, &hdr);
@@ -471,7 +473,8 @@ AC_DEFUN([AC_HAVE_HDIO_GETGEO],
   [ AC_MSG_CHECKING([for struct hd_geometry ])
     AC_COMPILE_IFELSE(
     [	AC_LANG_PROGRAM([[
-#include <linux/hdreg.h>,
+#include <linux/hdreg.h>
+#include <sys/ioctl.h>
 	]], [[
 struct hd_geometry hdr;
 ioctl(0, HDIO_GETGEO, &hdr);
Signature · 1 line
2.39.1