This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC_DRIVER_HOST_INITIALIZATION in gcc.c
> standard_startfile_prefix is initialized to a string in gcc.c, and never
> modified.
Ok, you start off with an invalid assumption. It *is* modified.
> standard_startfile_prefix_0 would not be initialized to a string, and
> would have a comment indicating that it exists for communication with
> the GCC_DRIVER_HOST_INITIALIZATION/UPDATE_PATH_HOST_CANONICALIZE macros
> that some ports define. This would make the relationship explicit, and
> easier to maintain.
So you want to change this:
/* This may be changed by the target */
char * startfile_prefix = "something";
scan_directory(startfile_prefix);
to this:
/* This is never changed */
const char * const startfile_prefix = "something";
/* This may be changed by the target, and overrides the above */
char * startfile_prefix_0 = 0;
if (startfile_prefix_0)
scan_directory(startfile_prefix_0);
else
scan_directory(startfile_prefix);
I object to this. It makes the code more confusing to read, more
difficult to maintain, and slower to execute. If the logic is not
done just right, it may even use files that it should not use, leading
to subtle (and thus hard to track down) bugs.
IMHO it would be better to just document the old use.