recover -frandom-seed from .rpo file
Mark Mitchell
mark@codesourcery.com
Sat Mar 10 00:00:00 GMT 2007
Alexandre Oliva wrote:
> from Alexandre Oliva <aoliva@redhat.com>
>
> * flags.h (flag_random_seed): Remove declaration, in favor of...
> * toplev.h (get_random_seed, set_random_seed): ... these.
> * tree.c (get_file_function_name): Use the former.
> * opts.c (common_handle_option): Use the latter.
> * toplev.c
>
> for gcc/cp/ChangeLog
> from Alexandre Oliva <aoliva@redhat.com>
>
> * cp/repo.c (init_repo): Initialize random_seed saved options.
> (finish_repo): Adjust.
> + if (old_args && !get_random_seed (true)
> + && (buf = strstr (old_args, "'-frandom-seed=")))
> + {
> + char *end;
> +
> + buf += sizeof ("'-frandom-seed=") - 1;
Use strlen. The sizeof hack is not necessary when compiling with GCC,
and it's harder to read.
> + for (end = buf; *end; end++)
> + if (end[0] == '\'' && (end[1] == '\0' || end[1] == ' '))
> + break;
Can you just use extract_string here? I would think so, since it looks
like you're doing the same thing that's done for the other users.
> + if (*end)
> + {
> + char *seed;
> + size_t len = end - buf;
> +
> + seed = XNEWVEC (char, len + 1);
> + memcpy (seed, buf, len);
If you use extract_string, this is just XSTRDUP.
Thanks,
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
More information about the Gcc-patches
mailing list