OSDN Git Service

* tree-ssa-loop-niter.c (inverse): Count in HOST_WIDE_INT if possible.
[pf3gnuchains/gcc-fork.git] / libcpp / directives.c
index b2b6b32..b60b7bc 100644 (file)
@@ -1145,6 +1145,11 @@ do_pragma (cpp_reader *pfile)
   const cpp_token *token, *pragma_token = pfile->cur_token;
   unsigned int count = 1;
 
+  /* Save the current position so that defer_pragmas mode can
+     copy the entire current line to a string.  It will not work
+     to use _cpp_backup_tokens as that does not reverse buffer->cur.  */
+  const uchar *line_start = CPP_BUFFER (pfile)->cur;
+
   pfile->state.prevent_expansion++;
 
   token = cpp_get_token (pfile);
@@ -1174,13 +1179,11 @@ do_pragma (cpp_reader *pfile)
   else if (CPP_OPTION (pfile, defer_pragmas))
     {
       /* Squirrel away the pragma text.  Pragmas are newline-terminated. */
-      const uchar *line_start, *line_end;
+      const uchar *line_end;
       uchar *s;
       cpp_string body;
       cpp_token *ptok;
 
-      _cpp_backup_tokens (pfile, count);
-      line_start = CPP_BUFFER (pfile)->cur;
       line_end = ustrchr (line_start, '\n');
 
       body.len = (line_end - line_start) + 1;
@@ -1416,10 +1419,13 @@ cpp_handle_deferred_pragma (cpp_reader *pfile, const cpp_string *s)
   cpp_token *saved_cur_token = pfile->cur_token;
   tokenrun *saved_cur_run = pfile->cur_run;
   bool saved_defer_pragmas = CPP_OPTION (pfile, defer_pragmas);
+  void (*saved_line_change) (cpp_reader *, const cpp_token *, int)
+    = pfile->cb.line_change;
 
   pfile->context = XNEW (cpp_context);
   pfile->context->macro = 0;
   pfile->context->prev = 0;
+  pfile->cb.line_change = NULL;
   CPP_OPTION (pfile, defer_pragmas) = false;
 
   run_directive (pfile, T_PRAGMA, s->text, s->len);
@@ -1428,6 +1434,7 @@ cpp_handle_deferred_pragma (cpp_reader *pfile, const cpp_string *s)
   pfile->context = saved_context;
   pfile->cur_token = saved_cur_token;
   pfile->cur_run = saved_cur_run;
+  pfile->cb.line_change = saved_line_change;
   CPP_OPTION (pfile, defer_pragmas) = saved_defer_pragmas;
 }