This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][AArch64][8/14] Implement TARGET_OPTION_VALID_ATTRIBUTE_P
- From: Marcus Shawcroft <marcus dot shawcroft at gmail dot com>
- To: James Greenhalgh <james dot greenhalgh at arm dot com>
- Cc: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>
- Date: Fri, 24 Jul 2015 09:00:46 +0100
- Subject: Re: [PATCH][AArch64][8/14] Implement TARGET_OPTION_VALID_ATTRIBUTE_P
- Authentication-results: sourceware.org; auth=none
- References: <55A7CBDB dot 9020908 at arm dot com> <20150721153733 dot GA13935 at arm dot com>
On 21 July 2015 at 16:37, James Greenhalgh <james.greenhalgh@arm.com> wrote:
> On Thu, Jul 16, 2015 at 04:20:59PM +0100, Kyrill Tkachov wrote:
>> +static bool
>> +aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr)
>> +{
>> + bool ret;
>> + bool invert = false;
>> +
>> + int len = strlen (arg_str);
>> +
>> + if (len == 0)
>> + {
>> + error ("malformed target %s", pragma_or_attr);
>> + return false;
>> + }
>> +
>> + char *str_to_check = (char *) alloca (len + 1);
>
> Seems to go against your approach earlier in the patch series of XSTRDUP,
> it would be nice to stay consistent.
Agreed, we should be consistent. Each of the other instances of
alloca/xstrdup that I've seen in this patch series are actually
superflous, we simply copy the string, use it then bin it, better to
remove the dup completely.
In the choice between xstrdup() and alloca(), since alloca() is an
option, better to choose alloca() and remove the need for each of the
explicit free() calls in the exit paths. The alloca() route makes it
less likely that we accidentally introduce a space leak in the future.
Cheers
/Marcus