8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing

Add ranges and constraint functions for GC flags.

Reviewed-by: kbarrett, jmasa, jwilhelm, gziemski, zmajo
This commit is contained in:
Sangheon Kim 2015-10-05 14:56:19 -07:00
parent 3f29249aee
commit b112b31e5b
14 changed files with 728 additions and 99 deletions

View file

@ -794,8 +794,10 @@ static bool set_bool_flag(const char* name, bool value, Flag::Flags origin) {
}
static bool set_fp_numeric_flag(const char* name, char* value, Flag::Flags origin) {
double v;
if (sscanf(value, "%lf", &v) != 1) {
char* end;
errno = 0;
double v = strtod(value, &end);
if ((errno != 0) || (*end != 0)) {
return false;
}
@ -979,9 +981,9 @@ bool Arguments::parse_argument(const char* arg, Flag::Flags origin) {
return set_string_flag(real_name, value, origin);
}
#define SIGNED_FP_NUMBER_RANGE "[-0123456789.]"
#define SIGNED_FP_NUMBER_RANGE "[-0123456789.eE+]"
#define SIGNED_NUMBER_RANGE "[-0123456789]"
#define NUMBER_RANGE "[0123456789]"
#define NUMBER_RANGE "[0123456789eE+-]"
char value[BUFLEN + 1];
char value2[BUFLEN + 1];
if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) SIGNED_NUMBER_RANGE "." "%" XSTR(BUFLEN) NUMBER_RANGE "%c", name, value, value2, &dummy) == 3) {