This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: cpplib startup patch


>>>>> Dave Brolley <brolley@cygnus.com> writes:

 > OK, I see what's going on. output_line_command is called from cpp_start_read
 > before lang_init gets called. In that case the patch needs some work:

 > o There are some other calls to output_line_command in cpp_sart_read that
 > should might need to be changed to output_initial_line_command.
 > o An initial #line directive beginning with whitespace should be recognized
 > since the non-cpplib compilers seem to do it.

It occurs to me that a better option might be to add a flag to note that
we're dealing with preprocessed code, and just suppress the call to
output_line_command if we are.  We should have such an option in any
case.

 > o There's probably no need to call check_newline from lang_init for cpplib.

We need the check_newline to set input_filename before we use it later in
lang_init.  Is this the right way to get the filename from cpplib?

  CPP_BUFER (&parse_in)->nominal_fname;

BTW, why does cpp_reader have a lineno member, but not filename or colno?

Another BTW: Under the current code, cpp_start_read queues up the the
artificial CPP_DIRECTIVE before the frontend has asked for a token; for
simplicity of the API, this should probably be changed so that it waits for
cpp_get_token like everybody else.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]