On 6 November 2021 01:21:43 CET, Marek Polacek via Gcc-patches
<[email protected]> wrote:
>
>Thanks, so like this? I'm including an incremental diff so that it's
>clear what changed:
>
>diff --git a/gcc/attribs.c b/gcc/attribs.c
>index d5fba7f4bbb..addfe6f6c80 100644
>--- a/gcc/attribs.c
>+++ b/gcc/attribs.c
>@@ -237,7 +237,7 @@ check_attribute_tables (void)
> the end of parsing of all TUs. */
> static vec<attribute_spec *> ignored_attributes_table;
>
>-/* Parse arguments ARGS of -Wno-attributes=.
>+/* Parse arguments V of -Wno-attributes=.
> Currently we accept:
> vendor::attr
> vendor::
>@@ -252,12 +252,15 @@ handle_ignored_attributes_option (vec<char *> *v)
>
> for (auto opt : v)
> {
>+ /* We're going to be modifying the string. */
>+ opt = xstrdup (opt);
> char *q = strstr (opt, "::");
> /* We don't accept '::attr'. */
> if (q == nullptr || q == opt)
> {
> error ("wrong argument to ignored attributes");
> inform (input_location, "valid format is %<ns::attr%> or %<ns::%>");
>+ free (opt);
> continue;
> }
Only xstrdup here, after the strstr check?
Should maybe strdup the rest here, not full opt..
thanks,
> /* Cut off the vendor part. */
>@@ -274,6 +277,7 @@ handle_ignored_attributes_option (vec<char *> *v)
> if (!valid_p (vendor) || !valid_p (attr))
> {
> error ("wrong argument to ignored attributes");
>+ free (opt);
> continue;
> }
> /* Turn "__attr__" into "attr" so that we have a canonical form of