Avoid gcc type-limits warnings.
This commit is contained in:
parent
8e3fb7f417
commit
3ea838d2a2
@ -1056,7 +1056,11 @@ malloc_conf_init(void)
|
|||||||
if (cont) \
|
if (cont) \
|
||||||
continue; \
|
continue; \
|
||||||
}
|
}
|
||||||
#define CONF_HANDLE_T_U(t, o, n, min, max, clip) \
|
#define CONF_MIN_no(um, min) false
|
||||||
|
#define CONF_MIN_yes(um, min) ((um) < (min))
|
||||||
|
#define CONF_MAX_no(um, max) false
|
||||||
|
#define CONF_MAX_yes(um, max) ((um) > (max))
|
||||||
|
#define CONF_HANDLE_T_U(t, o, n, min, max, check_min, check_max, clip) \
|
||||||
if (CONF_MATCH(n)) { \
|
if (CONF_MATCH(n)) { \
|
||||||
uintmax_t um; \
|
uintmax_t um; \
|
||||||
char *end; \
|
char *end; \
|
||||||
@ -1069,15 +1073,19 @@ malloc_conf_init(void)
|
|||||||
"Invalid conf value", \
|
"Invalid conf value", \
|
||||||
k, klen, v, vlen); \
|
k, klen, v, vlen); \
|
||||||
} else if (clip) { \
|
} else if (clip) { \
|
||||||
if ((min) != 0 && um < (min)) \
|
if (CONF_MIN_##check_min(um, \
|
||||||
|
(min))) \
|
||||||
o = (t)(min); \
|
o = (t)(min); \
|
||||||
else if (um > (max)) \
|
else if (CONF_MAX_##check_max( \
|
||||||
|
um, (max))) \
|
||||||
o = (t)(max); \
|
o = (t)(max); \
|
||||||
else \
|
else \
|
||||||
o = (t)um; \
|
o = (t)um; \
|
||||||
} else { \
|
} else { \
|
||||||
if (((min) != 0 && um < (min)) \
|
if (CONF_MIN_##check_min(um, \
|
||||||
|| um > (max)) { \
|
(min)) || \
|
||||||
|
CONF_MAX_##check_max(um, \
|
||||||
|
(max))) { \
|
||||||
malloc_conf_error( \
|
malloc_conf_error( \
|
||||||
"Out-of-range " \
|
"Out-of-range " \
|
||||||
"conf value", \
|
"conf value", \
|
||||||
@ -1087,10 +1095,13 @@ malloc_conf_init(void)
|
|||||||
} \
|
} \
|
||||||
continue; \
|
continue; \
|
||||||
}
|
}
|
||||||
#define CONF_HANDLE_UNSIGNED(o, n, min, max, clip) \
|
#define CONF_HANDLE_UNSIGNED(o, n, min, max, check_min, check_max, \
|
||||||
CONF_HANDLE_T_U(unsigned, o, n, min, max, clip)
|
clip) \
|
||||||
#define CONF_HANDLE_SIZE_T(o, n, min, max, clip) \
|
CONF_HANDLE_T_U(unsigned, o, n, min, max, \
|
||||||
CONF_HANDLE_T_U(size_t, o, n, min, max, clip)
|
check_min, check_max, clip)
|
||||||
|
#define CONF_HANDLE_SIZE_T(o, n, min, max, check_min, check_max, clip) \
|
||||||
|
CONF_HANDLE_T_U(size_t, o, n, min, max, \
|
||||||
|
check_min, check_max, clip)
|
||||||
#define CONF_HANDLE_SSIZE_T(o, n, min, max) \
|
#define CONF_HANDLE_SSIZE_T(o, n, min, max) \
|
||||||
if (CONF_MATCH(n)) { \
|
if (CONF_MATCH(n)) { \
|
||||||
long l; \
|
long l; \
|
||||||
@ -1133,7 +1144,7 @@ malloc_conf_init(void)
|
|||||||
*/
|
*/
|
||||||
CONF_HANDLE_SIZE_T(opt_lg_chunk, "lg_chunk", LG_PAGE +
|
CONF_HANDLE_SIZE_T(opt_lg_chunk, "lg_chunk", LG_PAGE +
|
||||||
LG_SIZE_CLASS_GROUP + (config_fill ? 2 : 1),
|
LG_SIZE_CLASS_GROUP + (config_fill ? 2 : 1),
|
||||||
(sizeof(size_t) << 3) - 1, true)
|
(sizeof(size_t) << 3) - 1, yes, yes, true)
|
||||||
if (strncmp("dss", k, klen) == 0) {
|
if (strncmp("dss", k, klen) == 0) {
|
||||||
int i;
|
int i;
|
||||||
bool match = false;
|
bool match = false;
|
||||||
@ -1159,7 +1170,7 @@ malloc_conf_init(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CONF_HANDLE_UNSIGNED(opt_narenas, "narenas", 1,
|
CONF_HANDLE_UNSIGNED(opt_narenas, "narenas", 1,
|
||||||
UINT_MAX, false)
|
UINT_MAX, yes, no, false)
|
||||||
if (strncmp("purge", k, klen) == 0) {
|
if (strncmp("purge", k, klen) == 0) {
|
||||||
int i;
|
int i;
|
||||||
bool match = false;
|
bool match = false;
|
||||||
@ -1230,7 +1241,7 @@ malloc_conf_init(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CONF_HANDLE_SIZE_T(opt_quarantine, "quarantine",
|
CONF_HANDLE_SIZE_T(opt_quarantine, "quarantine",
|
||||||
0, SIZE_T_MAX, false)
|
0, SIZE_T_MAX, no, no, false)
|
||||||
CONF_HANDLE_BOOL(opt_redzone, "redzone", true)
|
CONF_HANDLE_BOOL(opt_redzone, "redzone", true)
|
||||||
CONF_HANDLE_BOOL(opt_zero, "zero", true)
|
CONF_HANDLE_BOOL(opt_zero, "zero", true)
|
||||||
}
|
}
|
||||||
@ -1267,8 +1278,8 @@ malloc_conf_init(void)
|
|||||||
CONF_HANDLE_BOOL(opt_prof_thread_active_init,
|
CONF_HANDLE_BOOL(opt_prof_thread_active_init,
|
||||||
"prof_thread_active_init", true)
|
"prof_thread_active_init", true)
|
||||||
CONF_HANDLE_SIZE_T(opt_lg_prof_sample,
|
CONF_HANDLE_SIZE_T(opt_lg_prof_sample,
|
||||||
"lg_prof_sample", 0,
|
"lg_prof_sample", 0, (sizeof(uint64_t) << 3)
|
||||||
(sizeof(uint64_t) << 3) - 1, true)
|
- 1, no, yes, true)
|
||||||
CONF_HANDLE_BOOL(opt_prof_accum, "prof_accum",
|
CONF_HANDLE_BOOL(opt_prof_accum, "prof_accum",
|
||||||
true)
|
true)
|
||||||
CONF_HANDLE_SSIZE_T(opt_lg_prof_interval,
|
CONF_HANDLE_SSIZE_T(opt_lg_prof_interval,
|
||||||
@ -1284,7 +1295,14 @@ malloc_conf_init(void)
|
|||||||
malloc_conf_error("Invalid conf pair", k, klen, v,
|
malloc_conf_error("Invalid conf pair", k, klen, v,
|
||||||
vlen);
|
vlen);
|
||||||
#undef CONF_MATCH
|
#undef CONF_MATCH
|
||||||
|
#undef CONF_MATCH_VALUE
|
||||||
#undef CONF_HANDLE_BOOL
|
#undef CONF_HANDLE_BOOL
|
||||||
|
#undef CONF_MIN_no
|
||||||
|
#undef CONF_MIN_yes
|
||||||
|
#undef CONF_MAX_no
|
||||||
|
#undef CONF_MAX_yes
|
||||||
|
#undef CONF_HANDLE_T_U
|
||||||
|
#undef CONF_HANDLE_UNSIGNED
|
||||||
#undef CONF_HANDLE_SIZE_T
|
#undef CONF_HANDLE_SIZE_T
|
||||||
#undef CONF_HANDLE_SSIZE_T
|
#undef CONF_HANDLE_SSIZE_T
|
||||||
#undef CONF_HANDLE_CHAR_P
|
#undef CONF_HANDLE_CHAR_P
|
||||||
|
Loading…
Reference in New Issue
Block a user