This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: _cpp_line_note structure in front end
- From: Ian Lance Taylor <iant at google dot com>
- To: Nikola Ikonic <nikola dot ikonic at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 05 Feb 2010 18:13:56 -0800
- Subject: Re: _cpp_line_note structure in front end
- References: <737708261002051222u36805ff8ye35f79df05a26e64@mail.gmail.com>
Nikola Ikonic <nikola.ikonic@gmail.com> writes:
> I am currently working on modifying FE to "swallow" piece of code
> similar to this one:
>
> _Asm void DoSomething(some_parameters) {
> mov r1, r2
> mov r2, r3
> ... and similar assembler code
> }
>
> The idea is to just take assembler body and parse it as there was
> asm("") statement.
>
> I've managed to lex/parse whole this. However, when FE lexes assembler
> body of this function, my code fails starting from here:
>
> skipped_white:
> if (buffer->cur >= buffer->notes[buffer->cur_note].pos
> && !pfile->overlaid_buffer)
> {
> _cpp_process_line_notes (pfile, false);
> result->src_loc = pfile->line_table->highest_line;
> }
>
> It goes into _cpp_process_line_notes and then into abort()
>
> Above quoted code is located in _cpp_lex_direct() in lex.c file.
>
> In short, (buffer->cur>= buffer->notes[buffer->cur_note].pos) is true.
> I understand that I need to reposition
> pos field of _cpp_line_note structure, but I don't know where to
> position it. At the end of assembler body?
> At the closing parenthesis of DoSomething() function? Where should it
> go? What is the purpose of _cpp_line_note structure
> and this field at all?
The add_line_note function is used to record locations where a warning
should be issued. I don't see how any change you describe could cause
_cpp_process_line_notes to abort. _cpp_process_line_notes just looks
at the type of the note added by a call to add_line_note. You
shouldn't need to change anything.
Ian