[libglnx/wip/smcv/subproject] fdio: Skip glnx_try_fallocate() if _GNU_SOURCE is not defined



commit 238f7bfc494e16a0864f88ae891da6e7b3d82e5b
Author: Simon McVittie <smcv collabora com>
Date:   Thu Apr 21 19:56:41 2022 +0100

    fdio: Skip glnx_try_fallocate() if _GNU_SOURCE is not defined
    
    fallocate() is only visible in fcntl.h if _GNU_SOURCE is defined.
    Most users of libglnx will want to do that anyway, but it seems nicer
    to avoid "implicit declaration of function ‘fallocate’" warnings from
    simply including <libglnx.h> into naive code.
    
    Signed-off-by: Simon McVittie <smcv collabora com>

 glnx-fdio.h                         | 2 ++
 tests/use-as-subproject/meson.build | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/glnx-fdio.h b/glnx-fdio.h
index b6ba0ea..af53479 100644
--- a/glnx-fdio.h
+++ b/glnx-fdio.h
@@ -209,6 +209,7 @@ int glnx_renameat2_noreplace (int olddirfd, const char *oldpath,
 int glnx_renameat2_exchange (int olddirfd, const char *oldpath,
                              int newdirfd, const char *newpath);
 
+#ifdef _GNU_SOURCE
 /**
  * glnx_try_fallocate:
  * @fd: File descriptor
@@ -240,6 +241,7 @@ glnx_try_fallocate (int      fd,
 
   return TRUE;
 }
+#endif
 
 /**
  * glnx_fstat:
diff --git a/tests/use-as-subproject/meson.build b/tests/use-as-subproject/meson.build
index 65ba37b..2d08160 100644
--- a/tests/use-as-subproject/meson.build
+++ b/tests/use-as-subproject/meson.build
@@ -7,7 +7,6 @@ project(
   version : '0',
   meson_version : '>=0.49.0',
 )
-add_project_arguments('-D_GNU_SOURCE', language : 'c')
 
 configure_file(
   copy : true,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]