girparser: Adjust signedness() to avoid compiler warnings

No functional change intended.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2024-03-18 10:45:28 +00:00
parent 8c9b9bca35
commit c7e0f3e6b8

View File

@ -454,16 +454,7 @@ typedef struct {
unsigned int is_signed : 1; unsigned int is_signed : 1;
} IntegerAliasInfo; } IntegerAliasInfo;
/* Ignore warnings from use of signedness() */ #define signedness(T) (((T) -1) <= 0)
#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 (int) == 1);
G_STATIC_ASSERT (signedness (unsigned int) == 0); G_STATIC_ASSERT (signedness (unsigned int) == 0);
@ -493,12 +484,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;