]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2013-12-16 Chung-Lin Tang <cltang@codesourcery.com>
authorcltang <cltang@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Dec 2013 04:28:24 +0000 (04:28 +0000)
committercltang <cltang@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Dec 2013 04:28:24 +0000 (04:28 +0000)
* opts-common.c (integral_argument): Add support for
hexadecimal command option integer arguments. Update comments.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206008 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/opts-common.c

index 023a2291bac4692165447f67892fa5f17068e171..8b61a445cef99fa643a6648e7d633cae231724a5 100644 (file)
@@ -1,3 +1,8 @@
+2013-12-16  Chung-Lin Tang  <cltang@codesourcery.com>
+
+       * opts-common.c (integral_argument): Add support for
+       hexadecimal command option integer arguments. Update comments.
+
 2013-12-14   Jan Hubicka  <jh@suse.cz>
 
        PR ipa/59265
index 9d186a759cb5618b98eed91c60cc4fce38b98086..161ddf0122c9e17a8665eccd8097ff35c569dbd0 100644 (file)
@@ -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;
 }