[glib] Always assume that we use a gnu/c99 printf implementation



commit 98a0ab929d8c59ee27e5f470f11d077bb6a56749
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Sat May 5 18:33:47 2018 +0200

    Always assume that we use a gnu/c99 printf implementation
    
    On Windows we use gnulib and elsewhere we use glibc or similar.
    
    Also change G_GNUC_PRINTF to use gnu_printf instead of __format__ if
    possible because __format__ evaluates to ms_printf under MinGW,
    but we use gnulib there and not the system printf.
    gnu_printf is only available with GCC>=4.4 and not with clang.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=795569

 glib/gmacros.h |  7 +++++++
 meson.build    | 11 ++---------
 2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index fcd49bdcd..617e79a2d 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -146,10 +146,17 @@
 #endif
 
 #if     __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+#if !defined (__clang__) && G_GNUC_CHECK_VERSION (4, 4)
+#define G_GNUC_PRINTF( format_idx, arg_idx )    \
+  __attribute__((__format__ (gnu_printf, format_idx, arg_idx)))
+#define G_GNUC_SCANF( format_idx, arg_idx )     \
+  __attribute__((__format__ (gnu_scanf, format_idx, arg_idx)))
+#else
 #define G_GNUC_PRINTF( format_idx, arg_idx )    \
   __attribute__((__format__ (__printf__, format_idx, arg_idx)))
 #define G_GNUC_SCANF( format_idx, arg_idx )     \
   __attribute__((__format__ (__scanf__, format_idx, arg_idx)))
+#endif
 #define G_GNUC_FORMAT( arg_idx )                \
   __attribute__((__format_arg__ (arg_idx)))
 #define G_GNUC_NORETURN                         \
diff --git a/meson.build b/meson.build
index e1634865b..b1d22cfe5 100644
--- a/meson.build
+++ b/meson.build
@@ -1043,14 +1043,7 @@ else
   ssizet_size = cc.sizeof('ssize_t')
 endif
 
-# On Windows, MSVC supports both ll and I64 as format specifiers for 64-bit
-# integers, but some versions (at least 4.7.x) of MinGW only support I64.
-if host_system == 'windows'
-  int64_m = 'I64'
-else
-  int64_m = 'll'
-endif
-
+int64_m = 'll'
 char_align = cc.alignment('char')
 short_align = cc.alignment('short')
 int_align = cc.alignment('int')
@@ -1160,7 +1153,7 @@ if host_system == 'windows'
   glibconfig_conf.set('g_pid_type', 'void*')
   glibconfig_conf.set_quoted('g_pid_format', 'p')
   if host_machine.cpu_family() == 'x86_64'
-    glibconfig_conf.set_quoted('g_pollfd_format', '%#I64x')
+    glibconfig_conf.set_quoted('g_pollfd_format', '%#' + int64_m + 'x')
   else
     glibconfig_conf.set_quoted('g_pollfd_format', '%#x')
   endif


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