fix the triplet regexp to recognize triplets, not only quadruplets

Message ID 55157417.10605@ubuntu.com
State New, archived
Headers

Commit Message

Matthias Klose March 27, 2015, 3:15 p.m. UTC
  On 03/26/2015 11:03 AM, Pedro Alves wrote:
> On 03/23/2015 12:27 PM, Matthias Klose wrote:
>> This allows triplets where the vendor is not set. Should go to the trunk and the
>> 7.9 branch.
>>
>> Matthias
>>
>> 	* compile/compile.c (compile_to_object): Allow triplets.
>>
>> --- a/gdb/compile/compile.c
>> +++ b/gdb/compile/compile.c
>> @@ -483,7 +483,7 @@ compile_to_object (struct command_line *
>>
>>    os_rx = osabi_triplet_regexp (gdbarch_osabi (gdbarch));
>>    arch_rx = gdbarch_gnu_triplet_regexp (gdbarch);
>> -  triplet_rx = concat (arch_rx, "-[^-]*-", os_rx, (char *) NULL);
>> +  triplet_rx = concat (arch_rx, "(-[^-]*)?-", os_rx, (char *) NULL);
> 
> Add comment like:
> 
> /* Allow triplets with or without vendor set.  */
> 
> OK with that change.

updated patch attached. Please could somebody commit the patch?

Matthias

	* compile/compile.c (compile_to_object): Allow triplets with or without vendor set.
  

Comments

Pedro Alves March 31, 2015, 1:26 p.m. UTC | #1
On 03/27/2015 03:15 PM, Matthias Klose wrote:
> On 03/26/2015 11:03 AM, Pedro Alves wrote:
>> On 03/23/2015 12:27 PM, Matthias Klose wrote:
>>> This allows triplets where the vendor is not set. Should go to the trunk and the
>>> 7.9 branch.
>>>
>>> Matthias
>>>
>>> 	* compile/compile.c (compile_to_object): Allow triplets.
>>>
>>> --- a/gdb/compile/compile.c
>>> +++ b/gdb/compile/compile.c
>>> @@ -483,7 +483,7 @@ compile_to_object (struct command_line *
>>>
>>>    os_rx = osabi_triplet_regexp (gdbarch_osabi (gdbarch));
>>>    arch_rx = gdbarch_gnu_triplet_regexp (gdbarch);
>>> -  triplet_rx = concat (arch_rx, "-[^-]*-", os_rx, (char *) NULL);
>>> +  triplet_rx = concat (arch_rx, "(-[^-]*)?-", os_rx, (char *) NULL);
>>
>> Add comment like:
>>
>> /* Allow triplets with or without vendor set.  */
>>
>> OK with that change.
> 
> updated patch attached. Please could somebody commit the patch?

Pushed.

Thanks,
Pedro Alves
  

Patch

--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -483,7 +483,9 @@  compile_to_object (struct command_line *

   os_rx = osabi_triplet_regexp (gdbarch_osabi (gdbarch));
   arch_rx = gdbarch_gnu_triplet_regexp (gdbarch);
-  triplet_rx = concat (arch_rx, "-[^-]*-", os_rx, (char *) NULL);
+
+  /* Allow triplets with or without vendor set.  */
+  triplet_rx = concat (arch_rx, "(-[^-]*)?-", os_rx, (char *) NULL);
   make_cleanup (xfree, triplet_rx);

   /* Set compiler command-line arguments.  */