Hi, is there a way in libcpp, to figure out the previous directive
that was parsed correctly ? I guess the current directive being parsed
is stored in cpp_reader.directive by run_directive() /
_cpp_handle_directive(), but wasn't able to figure out for previous
directive(s). Shall I need to explicitly store the previous directive,
or is this done by libcpp ?

In case I require to explicitly store the previous directive,
is following the correct way to do it: ?

in end_directive():
/* Restore state.  */
  pfile->state.save_comments = ! CPP_OPTION (pfile, discard_comments);
  pfile->state.in_directive = 0;
  pfile->state.in_expression = 0;
  pfile->state.angled_headers = 0;
  pfile->prev_directive = pfile->directive; // here
  pfile->directive = 0;

I thought it better to add a member const cpp_hashnode *prev_directive
to cpp_reader, instead of creating a file-scope variable. Or should I
rather have file-scoped (in directives.c) prev_directive instead (if
modification to cpp_reader is not justified for this use case) ?

Thanks and Regards,
Prathamesh

Reply via email to