[glib] Move G_POLLFD_FORMAT to glibconfig.h
- From: Mikhail Zabaluev <mzabaluev src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Move G_POLLFD_FORMAT to glibconfig.h
- Date: Mon, 2 Nov 2015 18:05:50 +0000 (UTC)
commit 0dbc81c73ae19310f477e4888f4d4cba8474a846
Author: Mikhail Zabaluev <mikhail zabaluev gmail com>
Date: Thu Oct 29 10:54:34 2015 +0200
Move G_POLLFD_FORMAT to glibconfig.h
It's a platform-specific macro, so it belongs in glibconfig.h.
This ensures that g-ir-scanner will not pick the wrong definition
for introspection.
https://bugzilla.gnome.org/show_bug.cgi?id=757294
configure.ac | 8 +++++++-
glib/glibconfig.h.win32.in | 4 ++++
glib/gpoll.h | 11 ++---------
3 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 63c3c7c..9ad40f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -125,6 +125,7 @@ case "$host" in
*-*-mingw*)
glib_native_win32=yes
glib_pid_type='void *'
+ glib_pollfd_format='%#x'
glib_cv_stack_grows=no
# Unfortunately the mingw implementations of C99-style snprintf and vsnprintf
# don't seem to be quite good enough, at least not in mingw-runtime-3.14.
@@ -138,6 +139,7 @@ case "$host" in
case "$host" in
x86_64-*-*)
LIB_EXE_MACHINE_FLAG=X64
+ glib_pollfd_format='%#I64x'
;;
esac
@@ -146,6 +148,7 @@ case "$host" in
*)
glib_native_win32=no
glib_pid_type=int
+ glib_pollfd_format='%d'
;;
esac
case $host in
@@ -2866,6 +2869,8 @@ typedef gint64 goffset;
#define G_GOFFSET_FORMAT G_GINT64_FORMAT
#define G_GOFFSET_CONSTANT(val) G_GINT64_CONSTANT(val)
+#define G_POLLFD_FORMAT $g_pollfd_format
+
_______EOF
if test -z "$glib_unknown_void_p"; then
@@ -3333,8 +3338,9 @@ g_memory_barrier_needed="$glib_memory_barrier_needed"
g_gcc_atomic_ops="$glib_cv_gcc_has_builtin_atomic_operations"
g_module_suffix="$glib_gmodule_suffix"
-
g_pid_type="$glib_pid_type"
+g_pollfd_format="\"$glib_pollfd_format\""
+
case $host in
*-*-cygwin*)
glib_os="#define G_OS_UNIX
diff --git a/glib/glibconfig.h.win32.in b/glib/glibconfig.h.win32.in
index 418cbe0..35abba9 100644
--- a/glib/glibconfig.h.win32.in
+++ b/glib/glibconfig.h.win32.in
@@ -115,6 +115,8 @@ typedef gint64 goffset;
#ifndef _WIN64
+#define G_POLLFD_FORMAT "%#x"
+
#define GPOINTER_TO_INT(p) ((gint) (p))
#define GPOINTER_TO_UINT(p) ((guint) (p))
@@ -130,6 +132,8 @@ typedef unsigned int guintptr;
#else
+#define G_POLLFD_FORMAT "%#I64x"
+
#define GPOINTER_TO_INT(p) ((gint) (gint64) (p))
#define GPOINTER_TO_UINT(p) ((guint) (guint64) (p))
diff --git a/glib/gpoll.h b/glib/gpoll.h
index f28e3c5..95fe01c 100644
--- a/glib/gpoll.h
+++ b/glib/gpoll.h
@@ -22,6 +22,7 @@
#error "Only <glib.h> can be included directly."
#endif
+#include <glibconfig.h>
#include <glib/gtypes.h>
G_BEGIN_DECLS
@@ -106,15 +107,7 @@ struct _GPollFD
* A format specifier that can be used in printf()-style format strings
* when printing the @fd member of a #GPollFD.
*/
-#ifdef G_OS_WIN32
-#if GLIB_SIZEOF_VOID_P == 8
-#define G_POLLFD_FORMAT "%#I64x"
-#else
-#define G_POLLFD_FORMAT "%#x"
-#endif
-#else
-#define G_POLLFD_FORMAT "%d"
-#endif
+/* defined in glibconfig.h */
GLIB_AVAILABLE_IN_ALL
gint
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]