Advertisement
Guest User

_cpp_pop_buffer()

a guest
Jan 30th, 2014
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.29 KB | None | 0 0
  1.  
  2. /* Pops a single buffer, with a file change call-back if appropriate.
  3.    Then pushes the next -include file, if any remain.  */
  4. void
  5. _cpp_pop_buffer (cpp_reader *pfile)
  6. {
  7.   cpp_buffer *buffer = pfile->buffer;
  8.   struct _cpp_file *inc = buffer->file;
  9.   struct if_stack *ifs;
  10.   const unsigned char *to_free;
  11.   enum include_type inc_type;
  12.  
  13.   /* Walk back up the conditional stack till we reach its level at
  14.      entry to this file, issuing error messages.  */
  15.   for (ifs = buffer->if_stack; ifs; ifs = ifs->next)
  16.     cpp_error_with_line (pfile, CPP_DL_ERROR, ifs->line, 0,
  17.              "unterminated #%s", dtable[ifs->type].name);
  18.  
  19.   if (inc)
  20.   {
  21.     inc_type = buffer->inc_type;
  22.     if (CPP_WHEADER_GUARD (pfile) && pfile->mi_valid)
  23.       warn_header_guard (pfile);
  24.   }
  25.  
  26.   /* In case of a missing #endif.  */
  27.   pfile->state.skipping = 0;
  28.  
  29.   /* _cpp_do_file_change expects pfile->buffer to be the new one.  */
  30.   pfile->buffer = buffer->prev;
  31.  
  32.   to_free = buffer->to_free;
  33.   free (buffer->notes);
  34.  
  35.   /* Free the buffer object now; we may want to push a new buffer
  36.      in _cpp_push_next_include_file.  */
  37.   obstack_free (&pfile->buffer_ob, buffer);
  38.  
  39.   if (inc)
  40.     {
  41.       _cpp_pop_file_buffer (pfile, inc, to_free, inc_type);
  42.  
  43.       _cpp_do_file_change (pfile, LC_LEAVE, 0, 0, 0);
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement