Merge branch 'wip/smcv/signedness' into 'main'

girparser: Adjust signedness() macro

See merge request GNOME/glib!3972
This commit is contained in:
Philip Withnall
2024-03-18 11:25:21 +00:00

View File

@@ -454,16 +454,13 @@ 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) * signedness:
#pragma GCC diagnostic push * @T: a numeric type
#pragma GCC diagnostic ignored "-Wtype-limits" *
#elif defined(__clang__) * Returns: 1 if @T is signed, 0 if it is unsigned
#pragma clang diagnostic push */
#pragma clang diagnostic ignored "-Wtype-limits" #define signedness(T) (((T) -1) <= 0)
#endif
#define signedness(T) (((T) -1) < 0)
G_STATIC_ASSERT (signedness (int) == 1); G_STATIC_ASSERT (signedness (int) == 1);
G_STATIC_ASSERT (signedness (unsigned int) == 0); G_STATIC_ASSERT (signedness (unsigned int) == 0);
@@ -493,12 +490,6 @@ static IntegerAliasInfo integer_aliases[] = {
#undef INTEGER_ALIAS #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;