This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] refine getenv_spec_function fallback value for undefined variable
- From: Jeff Law <law at redhat dot com>
- To: Olivier Hainque <hainque at adacore dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 27 Jun 2018 21:01:13 -0600
- Subject: Re: [patch] refine getenv_spec_function fallback value for undefined variable
- References: <2AA1833D-72AA-4BDF-AB78-49EF8890C1C8@adacore.com>
On 06/22/2018 10:23 AM, Olivier Hainque wrote:
> Hello,
>
> getenv_spec_function features code to return a fake
> value for an undefined variable when we know that we
> shouldn't complain about the variable being undefined
> and that the variable value doesn't matter.
>
> This code is there to prevent errors about undefined
> variables referenced in specs when we're processing for
> mere "--version" on the command line, for example.
>
> The current code sets the value to the variable name.
>
> We have a local configuration (for VxWorks, patch coming) where
> %:getenv is used at the beginning of a STARTFILE_PREFIX_SPEC,
> like:
>
> #define STARTFILE_PREFIX_SPEC "%:getenv(VSB_DIR /usr/lib/common)"
>
> Now, for this spec we have a check that the value is an
> absolute path, and gcc --version for this configuration then
> complains with a message like:
>
> i586-wrs-vxworks7-gcc: fatal error: system path 'VSB_DIR/usr/lib/common' is not absolute
>
> This patch fixes this glitch by simply prepending a '/' to
> the fake value returned by getenv_spec_function for acceptable
> undefined variables.
>
> We have been using this in-house for months with gcc-7 on a wide
> range of targets.
>
> Bootstrapped and regression tested with mainline on x86_64-linux.
>
> Ok to commit ?
>
> Thanks in advance,
>
> With Kind Regards,
>
> Olivier
>
> 2018-06-22 Olivier Hainque <hainque@adacore.com>
>
> * gcc.c (getenv_spec_function): Prepend '/' to value for allowed
> undefined variables.
>
OK
jeff