[PATCH] Append PWD to path when using -fprofile-generate=/some/path.

Martin Liška mliska@suse.cz
Thu Dec 21 09:13:00 GMT 2017


On 12/20/2017 06:45 PM, Jakub Jelinek wrote:
> Another thing is that the "/" in there is wrong, so
>   const char dir_separator_str[] = { DIR_SEPARATOR, '\0' };
>   char *b = concat (profile_data_prefix, dir_separator_str, pwd, NULL);
> needs to be used instead.

This looks much nicer, I forgot about DIR_SEPARATOR.

> Does profile_data_prefix have any dir separators stripped from the end?

That's easy to achieve..

> Is pwd guaranteed to be relative in this case?

.. however this is absolute path, which would be problematic on a DOC based FS.
Maybe we should do the same path mangling as we do for purpose of gcov:

https://github.com/gcc-mirror/gcc/blob/master/gcc/gcov.c#L2424

What do you think about it?
Regarding the string manipulation: I'm not an expert, but work with string in C
is for me always a pain :)

Martin



More information about the Gcc-patches mailing list