comparison gcc/opts-common.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 /* Command line option handling. 1 /* Command line option handling.
2 Copyright (C) 2006-2017 Free Software Foundation, Inc. 2 Copyright (C) 2006-2018 Free Software Foundation, Inc.
3 3
4 This file is part of GCC. 4 This file is part of GCC.
5 5
6 GCC is free software; you can redistribute it and/or modify it under 6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free 7 the terms of the GNU General Public License as published by the Free
167 167
168 /* Return the best wrong match, or OPT_SPECIAL_unknown if none. */ 168 /* Return the best wrong match, or OPT_SPECIAL_unknown if none. */
169 return match_wrong_lang; 169 return match_wrong_lang;
170 } 170 }
171 171
172 /* If ARG is a non-negative decimal or hexadecimal integer, return its 172 /* If ARG is a non-negative decimal or hexadecimal integer representable
173 value, otherwise return -1. */ 173 in HOST_WIDE_INT return its value, otherwise return -1. If ERR is not
174 174 null set *ERR to zero on success or to EINVAL or to the value of errno
175 int 175 otherwise. */
176 integral_argument (const char *arg) 176
177 { 177 HOST_WIDE_INT
178 const char *p = arg; 178 integral_argument (const char *arg, int *err, bool byte_size_suffix)
179 179 {
180 while (*p && ISDIGIT (*p)) 180 if (!err)
181 p++; 181 err = &errno;
182 182
183 if (*p == '\0') 183 if (!ISDIGIT (*arg))
184 return atoi (arg); 184 {
185 185 *err = EINVAL;
186 /* It wasn't a decimal number - try hexadecimal. */ 186 return -1;
187 if (arg[0] == '0' && (arg[1] == 'x' || arg[1] == 'X')) 187 }
188 { 188
189 p = arg + 2; 189 *err = 0;
190 while (*p && ISXDIGIT (*p)) 190 errno = 0;
191 p++; 191
192 192 char *end = NULL;
193 if (p != arg + 2 && *p == '\0') 193 unsigned HOST_WIDE_INT unit = 1;
194 return strtol (arg, NULL, 16); 194 unsigned HOST_WIDE_INT value = strtoull (arg, &end, 10);
195 } 195
196 196 /* If the value is too large to be represented use the maximum
197 return -1; 197 representable value that strtoull sets VALUE to (setting
198 errno to ERANGE). */
199
200 if (end && *end)
201 {
202 if (!byte_size_suffix)
203 {
204 errno = 0;
205 value = strtoull (arg, &end, 0);
206 if (*end)
207 {
208 /* errno is most likely EINVAL here. */
209 *err = errno;
210 return -1;
211 }
212
213 return value;
214 }
215
216 /* Numeric option arguments are at most INT_MAX. Make it
217 possible to specify a larger value by accepting common
218 suffixes. */
219 if (!strcmp (end, "kB"))
220 unit = 1000;
221 else if (!strcasecmp (end, "KiB") || !strcmp (end, "KB"))
222 unit = 1024;
223 else if (!strcmp (end, "MB"))
224 unit = HOST_WIDE_INT_UC (1000) * 1000;
225 else if (!strcasecmp (end, "MiB"))
226 unit = HOST_WIDE_INT_UC (1024) * 1024;
227 else if (!strcasecmp (end, "GB"))
228 unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000;
229 else if (!strcasecmp (end, "GiB"))
230 unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024;
231 else if (!strcasecmp (end, "TB"))
232 unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000 * 1000;
233 else if (!strcasecmp (end, "TiB"))
234 unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024 * 1024;
235 else if (!strcasecmp (end, "PB"))
236 unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000 * 1000 * 1000;
237 else if (!strcasecmp (end, "PiB"))
238 unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024 * 1024 * 1024;
239 else if (!strcasecmp (end, "EB"))
240 unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000 * 1000 * 1000
241 * 1000;
242 else if (!strcasecmp (end, "EiB"))
243 unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024 * 1024 * 1024
244 * 1024;
245 else
246 {
247 /* This could mean an unknown suffix or a bad prefix, like
248 "+-1". */
249 *err = EINVAL;
250 return -1;
251 }
252 }
253
254 if (unit)
255 {
256 unsigned HOST_WIDE_INT prod = value * unit;
257 value = prod < value ? HOST_WIDE_INT_M1U : prod;
258 }
259
260 return value;
198 } 261 }
199 262
200 /* Return whether OPTION is OK for the language given by 263 /* Return whether OPTION is OK for the language given by
201 LANG_MASK. */ 264 LANG_MASK. */
202 static bool 265 static bool
228 storing the value in *VALUE if found, and returning false without 291 storing the value in *VALUE if found, and returning false without
229 modifying *VALUE if not found. */ 292 modifying *VALUE if not found. */
230 293
231 static bool 294 static bool
232 enum_arg_to_value (const struct cl_enum_arg *enum_args, 295 enum_arg_to_value (const struct cl_enum_arg *enum_args,
233 const char *arg, int *value, unsigned int lang_mask) 296 const char *arg, HOST_WIDE_INT *value,
297 unsigned int lang_mask)
234 { 298 {
235 unsigned int i; 299 unsigned int i;
236 300
237 for (i = 0; enum_args[i].arg != NULL; i++) 301 for (i = 0; enum_args[i].arg != NULL; i++)
238 if (strcmp (arg, enum_args[i].arg) == 0 302 if (strcmp (arg, enum_args[i].arg) == 0
248 /* Look up ARG in the enum used by option OPT_INDEX for language 312 /* Look up ARG in the enum used by option OPT_INDEX for language
249 LANG_MASK, returning true and storing the value in *VALUE if found, 313 LANG_MASK, returning true and storing the value in *VALUE if found,
250 and returning false without modifying *VALUE if not found. */ 314 and returning false without modifying *VALUE if not found. */
251 315
252 bool 316 bool
253 opt_enum_arg_to_value (size_t opt_index, const char *arg, int *value, 317 opt_enum_arg_to_value (size_t opt_index, const char *arg,
254 unsigned int lang_mask) 318 int *value, unsigned int lang_mask)
255 { 319 {
256 const struct cl_option *option = &cl_options[opt_index]; 320 const struct cl_option *option = &cl_options[opt_index];
257 321
258 gcc_assert (option->var_type == CLVC_ENUM); 322 gcc_assert (option->var_type == CLVC_ENUM);
259 323
260 return enum_arg_to_value (cl_enums[option->var_enum].values, arg, 324 HOST_WIDE_INT wideval;
261 value, lang_mask); 325 if (enum_arg_to_value (cl_enums[option->var_enum].values, arg,
326 &wideval, lang_mask))
327 {
328 *value = wideval;
329 return true;
330 }
331
332 return false;
262 } 333 }
263 334
264 /* Look of VALUE in ENUM_ARGS for language LANG_MASK and store the 335 /* Look of VALUE in ENUM_ARGS for language LANG_MASK and store the
265 corresponding string in *ARGP, returning true if the found string 336 corresponding string in *ARGP, returning true if the found string
266 was marked as canonical, false otherwise. If VALUE is not found 337 was marked as canonical, false otherwise. If VALUE is not found
297 368
298 /* Fill in the canonical option part of *DECODED with an option 369 /* Fill in the canonical option part of *DECODED with an option
299 described by OPT_INDEX, ARG and VALUE. */ 370 described by OPT_INDEX, ARG and VALUE. */
300 371
301 static void 372 static void
302 generate_canonical_option (size_t opt_index, const char *arg, int value, 373 generate_canonical_option (size_t opt_index, const char *arg,
374 HOST_WIDE_INT value,
303 struct cl_decoded_option *decoded) 375 struct cl_decoded_option *decoded)
304 { 376 {
305 const struct cl_option *option = &cl_options[opt_index]; 377 const struct cl_option *option = &cl_options[opt_index];
306 const char *opt_text = option->opt_text; 378 const char *opt_text = option->opt_text;
307 379
447 decode_cmdline_option (const char **argv, unsigned int lang_mask, 519 decode_cmdline_option (const char **argv, unsigned int lang_mask,
448 struct cl_decoded_option *decoded) 520 struct cl_decoded_option *decoded)
449 { 521 {
450 size_t opt_index; 522 size_t opt_index;
451 const char *arg = 0; 523 const char *arg = 0;
452 int value = 1; 524 HOST_WIDE_INT value = 1;
453 unsigned int result = 1, i, extra_args, separate_args = 0; 525 unsigned int result = 1, i, extra_args, separate_args = 0;
454 int adjust_len = 0; 526 int adjust_len = 0;
455 size_t total_len; 527 size_t total_len;
456 char *p; 528 char *p;
457 const struct cl_option *option; 529 const struct cl_option *option;
517 opt_index = OPT_SPECIAL_unknown; 589 opt_index = OPT_SPECIAL_unknown;
518 errors |= CL_ERR_NEGATIVE; 590 errors |= CL_ERR_NEGATIVE;
519 arg = argv[0]; 591 arg = argv[0];
520 goto done; 592 goto done;
521 } 593 }
594
595 /* Clear the initial value for size options (it will be overwritten
596 later based on the Init(value) specification in the opt file. */
597 if (option->var_type == CLVC_SIZE)
598 value = 0;
522 599
523 result = extra_args + 1; 600 result = extra_args + 1;
524 warn_message = option->warn_message; 601 warn_message = option->warn_message;
525 602
526 /* Check to see if the option is disabled for this configuration. */ 603 /* Check to see if the option is disabled for this configuration. */
584 if (option->alias_target != N_OPTS 661 if (option->alias_target != N_OPTS
585 && (!option->cl_separate_alias || have_separate_arg)) 662 && (!option->cl_separate_alias || have_separate_arg))
586 { 663 {
587 size_t new_opt_index = option->alias_target; 664 size_t new_opt_index = option->alias_target;
588 665
589 if (new_opt_index == OPT_SPECIAL_ignore) 666 if (new_opt_index == OPT_SPECIAL_ignore
667 || new_opt_index == OPT_SPECIAL_deprecated)
590 { 668 {
591 gcc_assert (option->alias_arg == NULL); 669 gcc_assert (option->alias_arg == NULL);
592 gcc_assert (option->neg_alias_arg == NULL); 670 gcc_assert (option->neg_alias_arg == NULL);
593 opt_index = new_opt_index; 671 opt_index = new_opt_index;
594 arg = NULL; 672 arg = NULL;
595 value = 1;
596 } 673 }
597 else 674 else
598 { 675 {
599 const struct cl_option *new_option = &cl_options[new_opt_index]; 676 const struct cl_option *new_option = &cl_options[new_opt_index];
600 677
678 arg_lower[j] = TOLOWER ((unsigned char) arg[j]); 755 arg_lower[j] = TOLOWER ((unsigned char) arg[j]);
679 arg_lower[len] = 0; 756 arg_lower[len] = 0;
680 arg = arg_lower; 757 arg = arg_lower;
681 } 758 }
682 759
683 /* If the switch takes an integer, convert it. */ 760 /* If the switch takes an integer argument, convert it. */
684 if (arg && option->cl_uinteger) 761 if (arg && (option->cl_uinteger || option->cl_host_wide_int))
685 { 762 {
686 value = integral_argument (arg); 763 int error = 0;
687 if (value == -1) 764 value = *arg ? integral_argument (arg, &error, option->cl_byte_size) : 0;
765 if (error)
688 errors |= CL_ERR_UINT_ARG; 766 errors |= CL_ERR_UINT_ARG;
689 767
690 /* Reject value out of a range. */ 768 /* Reject value out of a range. */
691 if (option->range_max != -1 769 if (option->range_max != -1
692 && (value < option->range_min || value > option->range_max)) 770 && (value < option->range_min || value > option->range_max))
739 total_len += (len != 0 ? len : 2) + 1; 817 total_len += (len != 0 ? len : 2) + 1;
740 } 818 }
741 else 819 else
742 decoded->canonical_option[i] = NULL; 820 decoded->canonical_option[i] = NULL;
743 } 821 }
744 if (opt_index != OPT_SPECIAL_unknown && opt_index != OPT_SPECIAL_ignore) 822 if (opt_index != OPT_SPECIAL_unknown && opt_index != OPT_SPECIAL_ignore
823 && opt_index != OPT_SPECIAL_deprecated)
745 { 824 {
746 generate_canonical_option (opt_index, arg, value, decoded); 825 generate_canonical_option (opt_index, arg, value, decoded);
747 if (separate_args > 1) 826 if (separate_args > 1)
748 { 827 {
749 for (i = 0; i < separate_args; i++) 828 for (i = 0; i < separate_args; i++)
917 opt_idx = old_decoded_options[i].opt_index; 996 opt_idx = old_decoded_options[i].opt_index;
918 switch (opt_idx) 997 switch (opt_idx)
919 { 998 {
920 case OPT_SPECIAL_unknown: 999 case OPT_SPECIAL_unknown:
921 case OPT_SPECIAL_ignore: 1000 case OPT_SPECIAL_ignore:
1001 case OPT_SPECIAL_deprecated:
922 case OPT_SPECIAL_program_name: 1002 case OPT_SPECIAL_program_name:
923 case OPT_SPECIAL_input_file: 1003 case OPT_SPECIAL_input_file:
924 goto keep; 1004 goto keep;
925 1005
926 /* Do not save OPT_fdiagnostics_color_, just remember the last one. */ 1006 /* Do not save OPT_fdiagnostics_color_, just remember the last one. */
1002 const struct cl_option_handlers *handlers, 1082 const struct cl_option_handlers *handlers,
1003 bool generated_p, diagnostic_context *dc) 1083 bool generated_p, diagnostic_context *dc)
1004 { 1084 {
1005 size_t opt_index = decoded->opt_index; 1085 size_t opt_index = decoded->opt_index;
1006 const char *arg = decoded->arg; 1086 const char *arg = decoded->arg;
1007 int value = decoded->value; 1087 HOST_WIDE_INT value = decoded->value;
1008 const struct cl_option *option = &cl_options[opt_index]; 1088 const struct cl_option *option = &cl_options[opt_index];
1009 void *flag_var = option_flag_var (opt_index, opts); 1089 void *flag_var = option_flag_var (opt_index, opts);
1010 size_t i; 1090 size_t i;
1011 1091
1012 if (flag_var) 1092 if (flag_var)
1032 command line. */ 1112 command line. */
1033 1113
1034 bool 1114 bool
1035 handle_generated_option (struct gcc_options *opts, 1115 handle_generated_option (struct gcc_options *opts,
1036 struct gcc_options *opts_set, 1116 struct gcc_options *opts_set,
1037 size_t opt_index, const char *arg, int value, 1117 size_t opt_index, const char *arg, HOST_WIDE_INT value,
1038 unsigned int lang_mask, int kind, location_t loc, 1118 unsigned int lang_mask, int kind, location_t loc,
1039 const struct cl_option_handlers *handlers, 1119 const struct cl_option_handlers *handlers,
1040 bool generated_p, diagnostic_context *dc) 1120 bool generated_p, diagnostic_context *dc)
1041 { 1121 {
1042 struct cl_decoded_option decoded; 1122 struct cl_decoded_option decoded;
1049 /* Fill in *DECODED with an option described by OPT_INDEX, ARG and 1129 /* Fill in *DECODED with an option described by OPT_INDEX, ARG and
1050 VALUE for a front end using LANG_MASK. This is used when the 1130 VALUE for a front end using LANG_MASK. This is used when the
1051 compiler generates options internally. */ 1131 compiler generates options internally. */
1052 1132
1053 void 1133 void
1054 generate_option (size_t opt_index, const char *arg, int value, 1134 generate_option (size_t opt_index, const char *arg, HOST_WIDE_INT value,
1055 unsigned int lang_mask, struct cl_decoded_option *decoded) 1135 unsigned int lang_mask, struct cl_decoded_option *decoded)
1056 { 1136 {
1057 const struct cl_option *option = &cl_options[opt_index]; 1137 const struct cl_option *option = &cl_options[opt_index];
1058 1138
1059 decoded->opt_index = opt_index; 1139 decoded->opt_index = opt_index;
1161 return true; 1241 return true;
1162 } 1242 }
1163 1243
1164 if (errors & CL_ERR_UINT_ARG) 1244 if (errors & CL_ERR_UINT_ARG)
1165 { 1245 {
1166 error_at (loc, "argument to %qs should be a non-negative integer", 1246 if (option->cl_byte_size)
1167 option->opt_text); 1247 error_at (loc, "argument to %qs should be a non-negative integer "
1248 "optionally followed by a size unit",
1249 option->opt_text);
1250 else
1251 error_at (loc, "argument to %qs should be a non-negative integer",
1252 option->opt_text);
1168 return true; 1253 return true;
1169 } 1254 }
1170 1255
1171 if (errors & CL_ERR_INT_RANGE_ARG) 1256 if (errors & CL_ERR_INT_RANGE_ARG)
1172 { 1257 {
1179 { 1264 {
1180 const struct cl_enum *e = &cl_enums[option->var_enum]; 1265 const struct cl_enum *e = &cl_enums[option->var_enum];
1181 unsigned int i; 1266 unsigned int i;
1182 char *s; 1267 char *s;
1183 1268
1269 auto_diagnostic_group d;
1184 if (e->unknown_error) 1270 if (e->unknown_error)
1185 error_at (loc, e->unknown_error, arg); 1271 error_at (loc, e->unknown_error, arg);
1186 else 1272 else
1187 error_at (loc, "unrecognized argument in option %qs", opt); 1273 error_at (loc, "unrecognized argument in option %qs", opt);
1188 1274
1235 } 1321 }
1236 1322
1237 if (decoded->opt_index == OPT_SPECIAL_ignore) 1323 if (decoded->opt_index == OPT_SPECIAL_ignore)
1238 return; 1324 return;
1239 1325
1326 if (decoded->opt_index == OPT_SPECIAL_deprecated)
1327 {
1328 /* Warn only about positive ignored options. */
1329 if (decoded->value)
1330 warning_at (loc, 0, "switch %qs is no longer supported", opt);
1331 return;
1332 }
1333
1240 option = &cl_options[decoded->opt_index]; 1334 option = &cl_options[decoded->opt_index];
1241 1335
1242 if (decoded->errors 1336 if (decoded->errors
1243 && cmdline_handle_error (loc, option, opt, decoded->arg, 1337 && cmdline_handle_error (loc, option, opt, decoded->arg,
1244 decoded->errors, lang_mask)) 1338 decoded->errors, lang_mask))
1262 location LOC, using diagnostic context DC if not NULL for 1356 location LOC, using diagnostic context DC if not NULL for
1263 diagnostic classification. */ 1357 diagnostic classification. */
1264 1358
1265 void 1359 void
1266 set_option (struct gcc_options *opts, struct gcc_options *opts_set, 1360 set_option (struct gcc_options *opts, struct gcc_options *opts_set,
1267 int opt_index, int value, const char *arg, int kind, 1361 int opt_index, HOST_WIDE_INT value, const char *arg, int kind,
1268 location_t loc, diagnostic_context *dc) 1362 location_t loc, diagnostic_context *dc)
1269 { 1363 {
1270 const struct cl_option *option = &cl_options[opt_index]; 1364 const struct cl_option *option = &cl_options[opt_index];
1271 void *flag_var = option_flag_var (opt_index, opts); 1365 void *flag_var = option_flag_var (opt_index, opts);
1272 void *set_flag_var = NULL; 1366 void *set_flag_var = NULL;
1281 set_flag_var = option_flag_var (opt_index, opts_set); 1375 set_flag_var = option_flag_var (opt_index, opts_set);
1282 1376
1283 switch (option->var_type) 1377 switch (option->var_type)
1284 { 1378 {
1285 case CLVC_BOOLEAN: 1379 case CLVC_BOOLEAN:
1286 *(int *) flag_var = value; 1380 if (option->cl_host_wide_int)
1287 if (set_flag_var) 1381 {
1288 *(int *) set_flag_var = 1; 1382 *(HOST_WIDE_INT *) flag_var = value;
1383 if (set_flag_var)
1384 *(HOST_WIDE_INT *) set_flag_var = 1;
1385 }
1386 else
1387 {
1388 *(int *) flag_var = value;
1389 if (set_flag_var)
1390 *(int *) set_flag_var = 1;
1391 }
1392
1289 break; 1393 break;
1290 1394
1395 case CLVC_SIZE:
1396 if (option->cl_host_wide_int)
1397 {
1398 *(HOST_WIDE_INT *) flag_var = value;
1399 if (set_flag_var)
1400 *(HOST_WIDE_INT *) set_flag_var = value;
1401 }
1402 else
1403 {
1404 *(int *) flag_var = value;
1405 if (set_flag_var)
1406 *(int *) set_flag_var = value;
1407 }
1408
1409 break;
1410
1291 case CLVC_EQUAL: 1411 case CLVC_EQUAL:
1292 if (option->cl_host_wide_int) 1412 if (option->cl_host_wide_int)
1293 *(HOST_WIDE_INT *) flag_var = (value 1413 {
1294 ? option->var_value 1414 *(HOST_WIDE_INT *) flag_var = (value
1295 : !option->var_value); 1415 ? option->var_value
1416 : !option->var_value);
1417 if (set_flag_var)
1418 *(HOST_WIDE_INT *) set_flag_var = 1;
1419 }
1296 else 1420 else
1297 *(int *) flag_var = (value 1421 {
1298 ? option->var_value 1422 *(int *) flag_var = (value
1299 : !option->var_value); 1423 ? option->var_value
1300 if (set_flag_var) 1424 : !option->var_value);
1301 *(int *) set_flag_var = 1; 1425 if (set_flag_var)
1426 *(int *) set_flag_var = 1;
1427 }
1302 break; 1428 break;
1303 1429
1304 case CLVC_BIT_CLEAR: 1430 case CLVC_BIT_CLEAR:
1305 case CLVC_BIT_SET: 1431 case CLVC_BIT_SET:
1306 if ((value != 0) == (option->var_type == CLVC_BIT_SET)) 1432 if ((value != 0) == (option->var_type == CLVC_BIT_SET))
1383 1509
1384 if (flag_var) 1510 if (flag_var)
1385 switch (option->var_type) 1511 switch (option->var_type)
1386 { 1512 {
1387 case CLVC_BOOLEAN: 1513 case CLVC_BOOLEAN:
1388 return *(int *) flag_var != 0; 1514 if (option->cl_host_wide_int)
1515 return *(HOST_WIDE_INT *) flag_var != 0;
1516 else
1517 return *(int *) flag_var != 0;
1389 1518
1390 case CLVC_EQUAL: 1519 case CLVC_EQUAL:
1391 if (option->cl_host_wide_int) 1520 if (option->cl_host_wide_int)
1392 return *(HOST_WIDE_INT *) flag_var == option->var_value; 1521 return *(HOST_WIDE_INT *) flag_var == option->var_value;
1393 else 1522 else
1402 case CLVC_BIT_SET: 1531 case CLVC_BIT_SET:
1403 if (option->cl_host_wide_int) 1532 if (option->cl_host_wide_int)
1404 return (*(HOST_WIDE_INT *) flag_var & option->var_value) != 0; 1533 return (*(HOST_WIDE_INT *) flag_var & option->var_value) != 0;
1405 else 1534 else
1406 return (*(int *) flag_var & option->var_value) != 0; 1535 return (*(int *) flag_var & option->var_value) != 0;
1536
1537 case CLVC_SIZE:
1538 if (option->cl_host_wide_int)
1539 return *(HOST_WIDE_INT *) flag_var != -1;
1540 else
1541 return *(int *) flag_var != -1;
1407 1542
1408 case CLVC_STRING: 1543 case CLVC_STRING:
1409 case CLVC_ENUM: 1544 case CLVC_ENUM:
1410 case CLVC_DEFER: 1545 case CLVC_DEFER:
1411 break; 1546 break;
1427 1562
1428 switch (cl_options[option].var_type) 1563 switch (cl_options[option].var_type)
1429 { 1564 {
1430 case CLVC_BOOLEAN: 1565 case CLVC_BOOLEAN:
1431 case CLVC_EQUAL: 1566 case CLVC_EQUAL:
1567 case CLVC_SIZE:
1432 state->data = flag_var; 1568 state->data = flag_var;
1433 state->size = (cl_options[option].cl_host_wide_int 1569 state->size = (cl_options[option].cl_host_wide_int
1434 ? sizeof (HOST_WIDE_INT) 1570 ? sizeof (HOST_WIDE_INT)
1435 : sizeof (int)); 1571 : sizeof (int));
1436 break; 1572 break;
1482 && !cl_options[opt_index].cl_negative_alias); 1618 && !cl_options[opt_index].cl_negative_alias);
1483 if (cl_options[opt_index].alias_arg) 1619 if (cl_options[opt_index].alias_arg)
1484 arg = cl_options[opt_index].alias_arg; 1620 arg = cl_options[opt_index].alias_arg;
1485 opt_index = cl_options[opt_index].alias_target; 1621 opt_index = cl_options[opt_index].alias_target;
1486 } 1622 }
1487 if (opt_index == OPT_SPECIAL_ignore) 1623 if (opt_index == OPT_SPECIAL_ignore || opt_index == OPT_SPECIAL_deprecated)
1488 return; 1624 return;
1489 if (dc) 1625 if (dc)
1490 diagnostic_classify_diagnostic (dc, opt_index, (diagnostic_t) kind, loc); 1626 diagnostic_classify_diagnostic (dc, opt_index, (diagnostic_t) kind, loc);
1491 if (imply) 1627 if (imply)
1492 { 1628 {
1493 const struct cl_option *option = &cl_options[opt_index]; 1629 const struct cl_option *option = &cl_options[opt_index];
1494 1630
1495 /* -Werror=foo implies -Wfoo. */ 1631 /* -Werror=foo implies -Wfoo. */
1496 if (option->var_type == CLVC_BOOLEAN || option->var_type == CLVC_ENUM) 1632 if (option->var_type == CLVC_BOOLEAN
1497 { 1633 || option->var_type == CLVC_ENUM
1498 int value = 1; 1634 || option->var_type == CLVC_SIZE)
1635 {
1636 HOST_WIDE_INT value = 1;
1499 1637
1500 if (arg && *arg == '\0' && !option->cl_missing_ok) 1638 if (arg && *arg == '\0' && !option->cl_missing_ok)
1501 arg = NULL; 1639 arg = NULL;
1502 1640
1503 if ((option->flags & CL_JOINED) && arg == NULL) 1641 if ((option->flags & CL_JOINED) && arg == NULL)
1505 cmdline_handle_error (loc, option, option->opt_text, arg, 1643 cmdline_handle_error (loc, option, option->opt_text, arg,
1506 CL_ERR_MISSING_ARG, lang_mask); 1644 CL_ERR_MISSING_ARG, lang_mask);
1507 return; 1645 return;
1508 } 1646 }
1509 1647
1510 /* If the switch takes an integer, convert it. */ 1648 /* If the switch takes an integer argument, convert it. */
1511 if (arg && option->cl_uinteger) 1649 if (arg && (option->cl_uinteger || option->cl_host_wide_int))
1512 { 1650 {
1513 value = integral_argument (arg); 1651 int error = 0;
1514 if (value == -1) 1652 value = *arg ? integral_argument (arg, &error,
1653 option->cl_byte_size) : 0;
1654 if (error)
1515 { 1655 {
1516 cmdline_handle_error (loc, option, option->opt_text, arg, 1656 cmdline_handle_error (loc, option, option->opt_text, arg,
1517 CL_ERR_UINT_ARG, lang_mask); 1657 CL_ERR_UINT_ARG, lang_mask);
1518 return; 1658 return;
1519 } 1659 }