This is the mail archive of the
mailing list for the GCC project.
Re: How to determine source location of pragma?
- From: Vanush Vaswani <vanush at gmail dot com>
- To: Manuel LÃpez-IbÃÃez <lopezibanez at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 13 Jan 2016 12:05:53 +1100
- Subject: Re: How to determine source location of pragma?
- Authentication-results: sourceware.org; auth=none
- References: <CAJbabricoN7J+eh9yJyKc-pUuiTAyPfjRBD=bDNTQLRPAgu12A at mail dot gmail dot com> <5693F1BC dot 3030206 at gmail dot com>
Is there anyway to get this information with gcc 4.x.x?
On Tue, Jan 12, 2016 at 5:17 AM, Manuel LÃpez-IbÃÃez
> On 11/01/16 01:08, Vanush Vaswani wrote:
>> I am new to GCC internals.
>> I'm trying to create a plugin to operate on pragmas. Currently have
>> this working using c_register_pragma with a callback.
>> The callback performs pragma_lex and is able to retrieve the string
>> token of the pragma based on this example.
>> How can I determine the line number of the pragma? I tried
>> DECL_SOURCE_LINE on the tree type but this returns 0. Do I have to
>> interact with cpplib?
> pragma_lex in GCC 6 has an optional &loc parameter. See
> handle_pragma_diagnostic() in c-pragma.c to see how it is used.