Try to fix things

glib_typeof wasn't defined in gmacros.h, so we never used the
better macros :(
This commit is contained in:
Matthias Clasen 2025-03-22 13:22:54 -04:00
parent 1d9c85185e
commit ff8cd60bfc
3 changed files with 9 additions and 8 deletions

View File

@ -24,8 +24,6 @@
#error "Only <glib.h> can be included directly." #error "Only <glib.h> can be included directly."
#endif #endif
#include <glib/gversionmacros.h>
/* /*
* We can only use __typeof__ on GCC >= 4.8, and not when compiling C++. Since * We can only use __typeof__ on GCC >= 4.8, and not when compiling C++. Since
* __typeof__ is used in a few places in GLib, provide a pre-processor symbol * __typeof__ is used in a few places in GLib, provide a pre-processor symbol
@ -37,8 +35,7 @@
#if !G_CXX_STD_CHECK_VERSION (11) && \ #if !G_CXX_STD_CHECK_VERSION (11) && \
(G_GNUC_CHECK_VERSION(4, 8) || defined(__clang__)) (G_GNUC_CHECK_VERSION(4, 8) || defined(__clang__))
#define glib_typeof(t) __typeof__ (t) #define glib_typeof(t) __typeof__ (t)
#elif G_CXX_STD_CHECK_VERSION (11) && \ #elif G_CXX_STD_CHECK_VERSION (11)
GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68
/* C++11 decltype() is close enough for our usage */ /* C++11 decltype() is close enough for our usage */
#include <type_traits> #include <type_traits>
#define glib_typeof(t) typename std::remove_reference<decltype (t)>::type #define glib_typeof(t) typename std::remove_reference<decltype (t)>::type

View File

@ -6,8 +6,6 @@
#ifndef __GLIBCONFIG_H__ #ifndef __GLIBCONFIG_H__
#define __GLIBCONFIG_H__ #define __GLIBCONFIG_H__
#include <glib/gmacros.h>
#include <limits.h> #include <limits.h>
#include <float.h> #include <float.h>
#mesondefine GLIB_HAVE_ALLOCA_H #mesondefine GLIB_HAVE_ALLOCA_H
@ -26,7 +24,9 @@
*/ */
#mesondefine GLIB_USING_SYSTEM_PRINTF #mesondefine GLIB_USING_SYSTEM_PRINTF
G_BEGIN_DECLS #ifdef G_CXX_STD_VERSION
extern "C" {
#endif
#define G_MINFLOAT FLT_MIN #define G_MINFLOAT FLT_MIN
#define G_MAXFLOAT FLT_MAX #define G_MAXFLOAT FLT_MAX
@ -215,6 +215,8 @@ typedef @g_pid_type@ GPid;
#mesondefine G_HAVE_FREE_SIZED #mesondefine G_HAVE_FREE_SIZED
G_END_DECLS #ifdef G_CXX_STD_VERSION
}
#endif
#endif /* __GLIBCONFIG_H__ */ #endif /* __GLIBCONFIG_H__ */

View File

@ -940,6 +940,8 @@
#undef ABS #undef ABS
#undef CLAMP #undef CLAMP
#include "glib-typeof.h"
#ifdef glib_typeof #ifdef glib_typeof
#define MAX(a, b) \ #define MAX(a, b) \