mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
macro: introduce DISABLE_WARNING_TYPE_LIMITS and make use of it everywhere
This commit is contained in:
parent
56e577c62f
commit
6028d766d1
@ -118,6 +118,10 @@
|
||||
_Pragma("GCC diagnostic push"); \
|
||||
_Pragma("GCC diagnostic ignored \"-Wfloat-equal\"")
|
||||
|
||||
#define DISABLE_WARNING_TYPE_LIMITS \
|
||||
_Pragma("GCC diagnostic push"); \
|
||||
_Pragma("GCC diagnostic ignored \"-Wtype-limits\"")
|
||||
|
||||
#define REENABLE_WARNING \
|
||||
_Pragma("GCC diagnostic pop")
|
||||
|
||||
|
@ -707,8 +707,7 @@ static int bus_cgroup_set_boolean(
|
||||
return 1; \
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
DISABLE_WARNING_TYPE_LIMITS;
|
||||
BUS_DEFINE_SET_CGROUP_WEIGHT(cpu_weight, CGROUP_MASK_CPU, CGROUP_WEIGHT_IS_OK, CGROUP_WEIGHT_INVALID);
|
||||
BUS_DEFINE_SET_CGROUP_WEIGHT(cpu_shares, CGROUP_MASK_CPU, CGROUP_CPU_SHARES_IS_OK, CGROUP_CPU_SHARES_INVALID);
|
||||
BUS_DEFINE_SET_CGROUP_WEIGHT(io_weight, CGROUP_MASK_IO, CGROUP_WEIGHT_IS_OK, CGROUP_WEIGHT_INVALID);
|
||||
@ -716,7 +715,7 @@ BUS_DEFINE_SET_CGROUP_WEIGHT(blockio_weight, CGROUP_MASK_BLKIO, CGROUP_BLKIO_WEI
|
||||
BUS_DEFINE_SET_CGROUP_LIMIT(memory, CGROUP_MASK_MEMORY, physical_memory_scale, 1);
|
||||
BUS_DEFINE_SET_CGROUP_LIMIT(memory_protection, CGROUP_MASK_MEMORY, physical_memory_scale, 0);
|
||||
BUS_DEFINE_SET_CGROUP_LIMIT(swap, CGROUP_MASK_MEMORY, physical_memory_scale, 0);
|
||||
#pragma GCC diagnostic pop
|
||||
REENABLE_WARNING;
|
||||
|
||||
static int bus_cgroup_set_tasks_max(
|
||||
Unit *u,
|
||||
|
@ -4091,10 +4091,9 @@ int json_dispatch_uid_gid(const char *name, JsonVariant *variant, JsonDispatchFl
|
||||
assert_cc(sizeof(uid_t) == sizeof(uint32_t));
|
||||
assert_cc(sizeof(gid_t) == sizeof(uint32_t));
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
DISABLE_WARNING_TYPE_LIMITS;
|
||||
assert_cc(((uid_t) -1 < (uid_t) 0) == ((gid_t) -1 < (gid_t) 0));
|
||||
#pragma GCC diagnostic pop
|
||||
REENABLE_WARNING;
|
||||
|
||||
if (json_variant_is_null(variant)) {
|
||||
*uid = UID_INVALID;
|
||||
|
@ -633,8 +633,7 @@ static void test_tempfn(void) {
|
||||
static const char chars[] =
|
||||
"Aąę„”\n루\377";
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
DISABLE_WARNING_TYPE_LIMITS;
|
||||
|
||||
static void test_fgetc(void) {
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
@ -665,7 +664,7 @@ static void test_fgetc(void) {
|
||||
assert_se(safe_fgetc(f, &c) == 0);
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
REENABLE_WARNING;
|
||||
|
||||
static const char buffer[] =
|
||||
"Some test data\n"
|
||||
|
@ -14,7 +14,7 @@
|
||||
/* Print information about various types. Useful when diagnosing
|
||||
* gcc diagnostics on an unfamiliar architecture. */
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
DISABLE_WARNING_TYPE_LIMITS;
|
||||
|
||||
#define info(t) \
|
||||
printf("%s → %zu bits%s, %zu byte alignment\n", STRINGIFY(t), \
|
||||
|
@ -363,10 +363,9 @@ static const char * const ntp_leap_table[4] = {
|
||||
[3] = "not synchronized",
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
DISABLE_WARNING_TYPE_LIMITS;
|
||||
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(ntp_leap, uint32_t);
|
||||
#pragma GCC diagnostic pop
|
||||
REENABLE_WARNING;
|
||||
|
||||
static int print_ntp_status_info(NTPStatusInfo *i) {
|
||||
char ts[FORMAT_TIMESPAN_MAX], jitter[FORMAT_TIMESPAN_MAX],
|
||||
|
Loading…
Reference in New Issue
Block a user