Hello,

The attached patch is a proposal to improve specs processing
so %* works in spec function arguments (it doesn't as of today).

The immediate motivation is to allow a cleaner implementation of
the -mmacosx-version-min support on darwin. I'll send a followup
patch for that if the preliminary improvement suggested here gets
approved. It seems generally useful in any case.

The idea is to propagate the matched pattern down into the spec
processing chain when we have it, in particular from do_spec_1 to
handle_spec_function, to eval_spec_function, to do_spec_2 and
then do_spec_1 for the arguments.

Testing-wise, we have this running nightly on all our targets,
currently based on gcc-7. We are using the facility on darwin in
particular, with the reworked support for -mmacosx-version-min
combined with local changes to support -mios-version-min as well.
 
Bootstrapped and regression tested with mainline on x86_64-linux.

Ok to commit ?

Thanks a lot in advance!

With Kind Regards,

Olivier

2018-06-05  Olivier Hainque  <hain...@adacore.com>

        * gcc.c (handle_spec_function): Accept a soft_matched_part
        argument, as do_spec_1.  Pass it down to ...
        (eval_spec_function): Accept a soft_matched_part argument,
        and pass it down to ...
        (do_spec_2): Accept a soft_matched_part argument, and pass
        it down to do_spec_1.
        (do_spec_1): Pass soft_matched_part to handle_spec_function.
        (handle_braces): Update call to handle_spec_function.
        (driver::set_up_specs): Update calls to do_spec_2.
        (compare_debug_dump_opt_spec_function): Likewise.
        (compare_debug_self_opt_spec_function): Likewise.

Attachment: specargs.diff
Description: Binary data

Reply via email to