[RFC 2/4] meson: Always define WITH_*_DECL macros

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

 



Instead of only defining them when the corresponding declaration
exists, define them all the time and make their value reflect
the availability.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 meson.build                |  2 ++
 tests/virmockstathelpers.c | 28 ++++++++++++++--------------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/meson.build b/meson.build
index 7845f60ff7..9628fbcd59 100644
--- a/meson.build
+++ b/meson.build
@@ -614,6 +614,8 @@ endforeach
 foreach function : stat_functions
   if cc.has_header_symbol('sys/stat.h', function)
     conf.set('WITH_@0@_DECL'.format(function.to_upper()), 1)
+  else
+    conf.set('WITH_@0@_DECL'.format(function.to_upper()), 0)
   endif
 endforeach
 
diff --git a/tests/virmockstathelpers.c b/tests/virmockstathelpers.c
index 8a76c5e369..a794788d03 100644
--- a/tests/virmockstathelpers.c
+++ b/tests/virmockstathelpers.c
@@ -80,47 +80,47 @@
  */
 
 #if !defined(__APPLE__)
-# if !defined(WITH___XSTAT_DECL)
-#  if defined(WITH_STAT)
-#   if !defined(WITH___XSTAT) && !defined(WITH_STAT64)
+# if !WITH___XSTAT_DECL
+#  if WITH_STAT
+#   if !WITH___XSTAT && !WITH_STAT64
 #    define MOCK_STAT
 #   endif
 #  endif
-#  if defined(WITH_STAT64)
+#  if WITH_STAT64
 #   define MOCK_STAT64
 #  endif
 # else /* WITH___XSTAT_DECL */
-#  if defined(WITH___XSTAT) && !defined(WITH___XSTAT64)
+#  if WITH___XSTAT && !WITH___XSTAT64
 #   define MOCK___XSTAT
 #  endif
-#  if defined(WITH___XSTAT64)
+#  if WITH___XSTAT64
 #   define MOCK___XSTAT64
 #  endif
 # endif /* WITH___XSTAT_DECL */
-# if !defined(WITH___LXSTAT_DECL)
-#  if defined(WITH_LSTAT)
-#   if !defined(WITH___LXSTAT) && !defined(WITH_LSTAT64)
+# if !WITH___LXSTAT_DECL
+#  if WITH_LSTAT
+#   if !WITH___LXSTAT && !WITH_LSTAT64
 #    define MOCK_LSTAT
 #   endif
 #  endif
-#  if defined(WITH_LSTAT64)
+#  if WITH_LSTAT64
 #   define MOCK_LSTAT64
 #  endif
 # else /* WITH___LXSTAT_DECL */
-#  if defined(WITH___LXSTAT) && !defined(WITH___LXSTAT64)
+#  if WITH___LXSTAT && !WITH___LXSTAT64
 #   define MOCK___LXSTAT
 #  endif
-#  if defined(WITH___LXSTAT64)
+#  if WITH___LXSTAT64
 #   define MOCK___LXSTAT64
 #  endif
 # endif /* WITH___LXSTAT_DECL */
 #else /* __APPLE__ */
 # define MOCK_STAT
-# if defined(WITH_STAT64_DECL)
+# if WITH_STAT64_DECL
 #  define MOCK_STAT64
 # endif
 # define MOCK_LSTAT
-# if defined(WITH_LSTAT64_DECL)
+# if WITH_LSTAT64_DECL
 #  define MOCK_LSTAT64
 # endif
 #endif
-- 
2.43.2
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux