OSDN Git Service

Index: libcpp/ChangeLog
[pf3gnuchains/gcc-fork.git] / gcc / c-lex.c
index 415785d..5be65f1 100644 (file)
@@ -283,11 +283,16 @@ cb_def_pragma (cpp_reader *pfile, source_location loc)
      -Wunknown-pragmas has been given.  */
   if (warn_unknown_pragmas > in_system_header)
     {
+      const unsigned char *space, *name;
+      const cpp_token *s;
 #ifndef USE_MAPPED_LOCATION
+      location_t fe_loc;
       const struct line_map *map = linemap_lookup (&line_table, loc);
+      fe_loc.file = map->to_file;
+      fe_loc.line = SOURCE_LINE (map, loc);
+#else
+      location_t fe_loc = loc;
 #endif
-      const unsigned char *space, *name;
-      const cpp_token *s;
 
       space = name = (const unsigned char *) "";
       s = cpp_get_token (pfile);
@@ -299,12 +304,7 @@ cb_def_pragma (cpp_reader *pfile, source_location loc)
            name = cpp_token_as_text (pfile, s);
        }
 
-#ifdef USE_MAPPED_LOCATION
-      input_location = loc;
-#else
-      input_line = SOURCE_LINE (map, loc);
-#endif
-      warning ("ignoring #pragma %s %s", space, name);
+      warning ("%Hignoring #pragma %s %s", &fe_loc, space, name);
     }
 }
 
@@ -332,7 +332,7 @@ cb_undef (cpp_reader * ARG_UNUSED (pfile), source_location loc,
    non-NULL.  */
 
 enum cpp_ttype
-c_lex_with_flags (tree *value, unsigned char *cpp_flags)
+c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags)
 {
   static bool no_more_pch;
   const cpp_token *tok;
@@ -344,6 +344,11 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
   type = tok->type;
   
  retry_after_at:
+#ifdef USE_MAPPED_LOCATION
+  *loc = tok->src_loc;
+#else
+  *loc = input_location;
+#endif
   switch (type)
     {
     case CPP_PADDING:
@@ -420,7 +425,7 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
       {
        unsigned char name[4];
        
-       *cpp_spell_token (parse_in, tok, name) = 0;
+       *cpp_spell_token (parse_in, tok, name, true) = 0;
        
        error ("stray %qs in program", name);
       }
@@ -487,7 +492,8 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
 enum cpp_ttype
 c_lex (tree *value)
 {
-  return c_lex_with_flags (value, NULL);
+  location_t loc;
+  return c_lex_with_flags (value, &loc, NULL);
 }
 
 /* Returns the narrowest C-visible unsigned type, starting with the