_cpp_line_note structure in front end
Ian Lance Taylor
iant@google.com
Sat Feb 6 02:14:00 GMT 2010
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
More information about the Gcc
mailing list