summaryrefslogtreecommitdiff
path: root/gcc/opts-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/opts-common.c')
-rw-r--r--gcc/opts-common.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index 9d186a759cb..007a546e388 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -1,5 +1,5 @@
/* Command line option handling.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 Free Software Foundation, Inc.
This file is part of GCC.
@@ -147,7 +147,7 @@ find_opt (const char *input, unsigned int lang_mask)
return match_wrong_lang;
}
-/* If ARG is a non-negative integer made up solely of digits, return its
+/* If ARG is a non-negative decimal or hexadecimal integer, return its
value, otherwise return -1. */
int
@@ -161,6 +161,17 @@ integral_argument (const char *arg)
if (*p == '\0')
return atoi (arg);
+ /* It wasn't a decimal number - try hexadecimal. */
+ if (arg[0] == '0' && (arg[1] == 'x' || arg[1] == 'X'))
+ {
+ p = arg + 2;
+ while (*p && ISXDIGIT (*p))
+ p++;
+
+ if (p != arg + 2 && *p == '\0')
+ return strtol (arg, NULL, 16);
+ }
+
return -1;
}