This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: how to make GCC option hook aware
- From: Andre Groenewald <adres dot is dot gevat at gmail dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Mon, 19 Feb 2018 20:48:24 +0200
- Subject: Re: how to make GCC option hook aware
- Authentication-results: sourceware.org; auth=none
- References: <CAHDABsfn_UEAJnDQEPt=P-2Y8aHuH1inP9qLca1-1LuK4VosCA@mail.gmail.com> <alpine.LSU.2.21.1802191522270.825@wotan.suse.de>
I followed your advice and every works great.
Thank you,
André
On Mon, Feb 19, 2018 at 5:25 PM, Michael Matz <matz@suse.de> wrote:
> Hi,
>
> On Sat, 17 Feb 2018, Andre Groenewald wrote:
>
>> Hi GCC folks,
>>
>> I have implemented a function for LANG_HOOKS_HANDLE_OPTION for my toy
>> language front end to handle options.
>>
>> The specific option is populated in lang.opt as fdemo-debug
>>
>> My lang-specs file has the following: {"@demo", "demo1 %i
>> %(cc1_options) %{!fsyntax-only:%(invoke_as)}", 0, 1, 0},
>>
>> Everything compiles and the front end gets invoked. GCC even suggest
>> the correct the flag when mistyped, but my function
>> demo_langhook_handle_option doesn't get invoked.
>>
>> What else do I need to implement to get this working.
>
> Have you also implemented the LANG_HOOKS_OPTION_LANG_MASK hook? That
> selects which options for which languages are actually fed to the other
> hook. Your lang.opt needs to specify the language as well (say Foo), then
> your lang_mask hook needs to include at least CL_Foo (a bit mask). See
> e.g. the simple implementation in brig and lto.
>
>
> Ciao,
> Michael.