diff gcc/c-family/c-ppoutput.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
line wrap: on
line diff
--- a/gcc/c-family/c-ppoutput.c	Fri Oct 27 22:46:09 2017 +0900
+++ b/gcc/c-family/c-ppoutput.c	Thu Oct 25 07:37:49 2018 +0900
@@ -1,5 +1,5 @@
 /* Preprocess only, using cpplib.
-   Copyright (C) 1995-2017 Free Software Foundation, Inc.
+   Copyright (C) 1995-2018 Free Software Foundation, Inc.
    Written by Per Bothner, 1994-95.
 
    This program is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
 #include "c-common.h"		/* For flags.  */
 #include "../libcpp/internal.h"
 #include "c-pragma.h"		/* For parse_in.  */
+#include "file-prefix-map.h"    /* remap_macro_filename()  */
 
 /* Encapsulates state used to convert a stream of tokens into a text
    file.  */
@@ -151,6 +152,7 @@
 
   cb->has_attribute = c_common_has_attribute;
   cb->get_source_date_epoch = cb_get_source_date_epoch;
+  cb->remap_filename = remap_macro_filename;
 
   /* Initialize the print structure.  */
   print.src_line = 1;
@@ -299,7 +301,7 @@
   struct _cpp_dir_only_callbacks cb;
 
   cb.print_lines = print_lines_directives_only;
-  cb.maybe_print_line = (void (*) (source_location)) maybe_print_line;
+  cb.maybe_print_line = maybe_print_line;
 
   _cpp_preprocess_dir_only (pfile, &cb);
 }
@@ -530,13 +532,14 @@
 cb_used_define (cpp_reader *pfile, source_location line ATTRIBUTE_UNUSED,
 		cpp_hashnode *node)
 {
-  macro_queue *q;
-  if (node->flags & NODE_BUILTIN)
-    return;
-  q = XNEW (macro_queue);
-  q->macro = xstrdup ((const char *) cpp_macro_definition (pfile, node));
-  q->next = define_queue;
-  define_queue = q;
+  if (cpp_user_macro_p (node))
+    {
+      macro_queue *q;
+      q = XNEW (macro_queue);
+      q->macro = xstrdup ((const char *) cpp_macro_definition (pfile, node));
+      q->next = define_queue;
+      define_queue = q;
+    }
 }
 
 static void
@@ -661,11 +664,9 @@
 	  /* Bring current file to correct line when entering a new file.  */
 	  if (map->reason == LC_ENTER)
 	    {
-	      const line_map_ordinary *from = INCLUDED_FROM (line_table, map);
-	      maybe_print_line (LAST_SOURCE_LINE_LOCATION (from));
+	      maybe_print_line (linemap_included_from (map));
+	      flags = " 1";
 	    }
-	  if (map->reason == LC_ENTER)
-	    flags = " 1";
 	  else if (map->reason == LC_LEAVE)
 	    flags = " 2";
 	  print_line (map->start_location, flags);
@@ -688,7 +689,7 @@
 static int
 dump_macro (cpp_reader *pfile, cpp_hashnode *node, void *v ATTRIBUTE_UNUSED)
 {
-  if (node->type == NT_MACRO && !(node->flags & NODE_BUILTIN))
+  if (cpp_user_macro_p (node))
     {
       fputs ("#define ", print.outf);
       fputs ((const char *) cpp_macro_definition (pfile, node),