comparison gcc/c-objc-common.c @ 67:f6334be47118

update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 22 Mar 2011 17:18:12 +0900
parents b7f97abdc517
children
comparison
equal deleted inserted replaced
65:65488c3d617d 67:f6334be47118
22 #include "system.h" 22 #include "system.h"
23 #include "coretypes.h" 23 #include "coretypes.h"
24 #include "tree.h" 24 #include "tree.h"
25 #include "c-tree.h" 25 #include "c-tree.h"
26 #include "intl.h" 26 #include "intl.h"
27 #include "c-pretty-print.h" 27 #include "c-family/c-pretty-print.h"
28 #include "flags.h" 28 #include "flags.h"
29 #include "diagnostic.h" 29 #include "diagnostic.h"
30 #include "tree-pretty-print.h" 30 #include "tree-pretty-print.h"
31 #include "langhooks.h" 31 #include "langhooks.h"
32 #include "c-objc-common.h" 32 #include "c-objc-common.h"
77 is as follows: 77 is as follows:
78 %D: a general decl, 78 %D: a general decl,
79 %E: an identifier or expression, 79 %E: an identifier or expression,
80 %F: a function declaration, 80 %F: a function declaration,
81 %T: a type. 81 %T: a type.
82 82 %V: a list of type qualifiers from a tree.
83 These format specifiers form a subset of the format specifiers set used 83 %v: an explicit list of type qualifiers
84 by the C++ front-end. 84 %#v: an explicit list of type qualifiers of a function type.
85
85 Please notice when called, the `%' part was already skipped by the 86 Please notice when called, the `%' part was already skipped by the
86 diagnostic machinery. */ 87 diagnostic machinery. */
87 static bool 88 static bool
88 c_tree_printer (pretty_printer *pp, text_info *text, const char *spec, 89 c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
89 int precision, bool wide, bool set_locus, bool hash) 90 int precision, bool wide, bool set_locus, bool hash)
90 { 91 {
91 tree t; 92 tree t = NULL_TREE;
92 tree name; 93 tree name;
93 c_pretty_printer *cpp = (c_pretty_printer *) pp; 94 c_pretty_printer *cpp = (c_pretty_printer *) pp;
94 pp->padding = pp_none; 95 pp->padding = pp_none;
95 96
96 if (precision != 0 || wide || hash) 97 if (precision != 0 || wide)
97 return false; 98 return false;
98 99
99 if (*spec == 'K') 100 if (*spec == 'K')
100 { 101 {
101 percent_K_format (text); 102 percent_K_format (text);
102 return true; 103 return true;
103 } 104 }
104 105
105 t = va_arg (*text->args_ptr, tree); 106 if (*spec != 'v')
106 107 {
107 if (set_locus && text->locus) 108 t = va_arg (*text->args_ptr, tree);
108 *text->locus = DECL_SOURCE_LOCATION (t); 109 if (set_locus && text->locus)
110 *text->locus = DECL_SOURCE_LOCATION (t);
111 }
109 112
110 switch (*spec) 113 switch (*spec)
111 { 114 {
112 case 'D': 115 case 'D':
113 if (DECL_DEBUG_EXPR_IS_FROM (t) && DECL_DEBUG_EXPR (t)) 116 if (DECL_DEBUG_EXPR_IS_FROM (t) && DECL_DEBUG_EXPR (t))
153 pp_identifier (cpp, IDENTIFIER_POINTER (t)); 156 pp_identifier (cpp, IDENTIFIER_POINTER (t));
154 else 157 else
155 pp_expression (cpp, t); 158 pp_expression (cpp, t);
156 return true; 159 return true;
157 160
161 case 'V':
162 pp_c_type_qualifier_list (cpp, t);
163 return true;
164
165 case 'v':
166 pp_c_cv_qualifiers (cpp, va_arg (*text->args_ptr, int), hash);
167 return true;
168
158 default: 169 default:
159 return false; 170 return false;
160 } 171 }
161 172
162 pp_string (cpp, _("({anonymous})")); 173 pp_string (cpp, _("({anonymous})"));
171 } 182 }
172 183
173 void 184 void
174 c_initialize_diagnostics (diagnostic_context *context) 185 c_initialize_diagnostics (diagnostic_context *context)
175 { 186 {
176 pretty_printer *base = context->printer; 187 pretty_printer *base;
177 c_pretty_printer *pp = XNEW (c_pretty_printer); 188 c_pretty_printer *pp;
189
190 c_common_initialize_diagnostics (context);
191
192 base = context->printer;
193 pp = XNEW (c_pretty_printer);
178 memcpy (pp_base (pp), base, sizeof (pretty_printer)); 194 memcpy (pp_base (pp), base, sizeof (pretty_printer));
179 pp_c_pretty_printer_init (pp); 195 pp_c_pretty_printer_init (pp);
180 context->printer = (pretty_printer *) pp; 196 context->printer = (pretty_printer *) pp;
181 197
182 /* It is safe to free this object because it was previously XNEW()'d. */ 198 /* It is safe to free this object because it was previously XNEW()'d. */