mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
Merge branch 'wip/smcv/girxml-timet' into 'main'
girparser: Allow time_t, off_t, etc. to appear in GIR XML See merge request GNOME/glib!3967
This commit is contained in:
@@ -32,6 +32,12 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <time.h> /* For time_t */
|
||||||
|
#include <sys/types.h> /* For off_t on both Unix and Windows */
|
||||||
|
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
|
#include <sys/socket.h> /* For socklen_t */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is a "major" version in the sense that it's only bumped
|
/* This is a "major" version in the sense that it's only bumped
|
||||||
* for incompatible changes.
|
* for incompatible changes.
|
||||||
@@ -448,6 +454,19 @@ typedef struct {
|
|||||||
unsigned int is_signed : 1;
|
unsigned int is_signed : 1;
|
||||||
} IntegerAliasInfo;
|
} IntegerAliasInfo;
|
||||||
|
|
||||||
|
/* Ignore warnings from use of signedness() */
|
||||||
|
#if G_GNUC_CHECK_VERSION(4, 6)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||||
|
#elif defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wtype-limits"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define signedness(T) (((T) -1) < 0)
|
||||||
|
G_STATIC_ASSERT (signedness (int) == 1);
|
||||||
|
G_STATIC_ASSERT (signedness (unsigned int) == 0);
|
||||||
|
|
||||||
static IntegerAliasInfo integer_aliases[] = {
|
static IntegerAliasInfo integer_aliases[] = {
|
||||||
{ "gchar", SIZEOF_CHAR, 1 },
|
{ "gchar", SIZEOF_CHAR, 1 },
|
||||||
{ "guchar", SIZEOF_CHAR, 0 },
|
{ "guchar", SIZEOF_CHAR, 0 },
|
||||||
@@ -461,8 +480,25 @@ static IntegerAliasInfo integer_aliases[] = {
|
|||||||
{ "gsize", GLIB_SIZEOF_SIZE_T, 0 },
|
{ "gsize", GLIB_SIZEOF_SIZE_T, 0 },
|
||||||
{ "gintptr", sizeof (gintptr), 1 },
|
{ "gintptr", sizeof (gintptr), 1 },
|
||||||
{ "guintptr", sizeof (guintptr), 0 },
|
{ "guintptr", sizeof (guintptr), 0 },
|
||||||
|
#define INTEGER_ALIAS(T) { #T, sizeof (T), signedness (T) }
|
||||||
|
INTEGER_ALIAS (off_t),
|
||||||
|
INTEGER_ALIAS (time_t),
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
|
INTEGER_ALIAS (dev_t),
|
||||||
|
INTEGER_ALIAS (gid_t),
|
||||||
|
INTEGER_ALIAS (pid_t),
|
||||||
|
INTEGER_ALIAS (socklen_t),
|
||||||
|
INTEGER_ALIAS (uid_t),
|
||||||
|
#endif
|
||||||
|
#undef INTEGER_ALIAS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if G_GNUC_CHECK_VERSION(4, 6)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#elif defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *str;
|
const char *str;
|
||||||
int tag;
|
int tag;
|
||||||
|
Reference in New Issue
Block a user