1/* Stub functions for Objective-C and Objective-C++ routines
2   that are called from within the C and C++ front-ends,
3   respectively.
4   Copyright (C) 1991, 1995, 1997, 1998,
5   1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6
7This file is part of GCC.
8
9GCC is free software; you can redistribute it and/or modify it under
10the terms of the GNU General Public License as published by the Free
11Software Foundation; either version 2, or (at your option) any later
12version.
13
14GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15WARRANTY; without even the implied warranty of MERCHANTABILITY or
16FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17for more details.
18
19You should have received a copy of the GNU General Public License
20along with GCC; see the file COPYING.  If not, write to the Free
21Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
2202110-1301, USA.  */
23
24#include "config.h"
25#include "system.h"
26#include "coretypes.h"
27#include "tree.h"
28#include "c-common.h"
29
30tree
31objc_is_class_name (tree ARG_UNUSED (arg))
32{
33  return 0;
34}
35
36tree
37objc_is_id (tree ARG_UNUSED (arg))
38{
39  return 0;
40}
41
42tree
43objc_is_object_ptr (tree ARG_UNUSED (arg))
44{
45  return 0;
46}
47
48/* APPLE LOCAL begin radar 4133425 */
49bool objc_diagnose_private_ivar (tree ARG_UNUSED (arg))
50{
51  return false;
52}
53/* APPLE LOCAL end radar 4133425 */
54
55tree
56objc_lookup_ivar (tree other, tree ARG_UNUSED (arg))
57{
58  /* Just use whatever C/C++ found.  */
59  return other;
60}
61
62void
63objc_check_decl (tree ARG_UNUSED (decl))
64{
65}
66
67/* APPLE LOCAL begin radar 4281748 */
68void
69objc_check_global_decl (tree ARG_UNUSED (decl))
70{
71}
72/* APPLE LOCAL end radar 4281748 */
73
74/* APPLE LOCAL begin radar 4330422 */
75tree
76objc_non_volatilized_type (tree type)
77{
78  return type;
79}
80/* APPLE LOCAL end radar 4330422 */
81
82/* APPLE LOCAL begin radar 4697411 */
83void
84objc_volatilize_component_ref (tree ARG_UNUSED (cref), tree ARG_UNUSED (type))
85{
86}
87/* APPLE LOCAL end radar 4697411 */
88
89int
90objc_is_reserved_word (tree ARG_UNUSED (ident))
91{
92  return 0;
93}
94
95/* APPLE LOCAL begin 4154928 */
96tree
97objc_common_type (tree ARG_UNUSED (type1), tree ARG_UNUSED (type2))
98{
99  return false;
100}
101/* APPLE LOCAL end 4154928 */
102
103bool
104objc_compare_types (tree ARG_UNUSED (ltyp), tree ARG_UNUSED (rtyp),
105		    /* APPLE LOCAL begin radar 6231433 */
106		    int ARG_UNUSED (argno), tree ARG_UNUSED (callee),
107		    const char * ARG_UNUSED (message))
108		    /* APPLE LOCAL end radar 6231433 */
109{
110  return false;
111}
112
113/* APPLE LOCAL begin radar 4229905 - radar 6231433 */
114bool
115objc_have_common_type (tree ARG_UNUSED (ltyp), tree ARG_UNUSED (rtyp),
116		       int ARG_UNUSED (argno), tree ARG_UNUSED (callee),
117		       const char * ARG_UNUSED (message))
118{
119  return false;
120}
121/* APPLE LOCAL end radar 4229905 - radar 6231433 */
122
123void
124objc_volatilize_decl (tree ARG_UNUSED (decl))
125{
126}
127
128bool
129objc_type_quals_match (tree ARG_UNUSED (ltyp), tree ARG_UNUSED (rtyp))
130{
131  return false;
132}
133
134tree
135objc_rewrite_function_call (tree function, tree ARG_UNUSED (params))
136{
137  return function;
138}
139
140tree
141objc_message_selector (void)
142{
143  return 0;
144}
145
146void
147objc_declare_alias (tree ARG_UNUSED (alias), tree ARG_UNUSED (orig))
148{
149}
150
151void
152objc_declare_class (tree ARG_UNUSED (list))
153{
154}
155
156void
157/* APPLE LOCAL begin radar 4947311 - protocol attributes */
158objc_declare_protocols (tree ARG_UNUSED (list), tree ARG_UNUSED (attributes))
159{
160}
161
162void
163objc_start_protocol (tree ARG_UNUSED (proto),
164		     tree ARG_UNUSED (protorefs),
165		     tree ARG_UNUSED (attributes))
166{
167}
168/* APPLE LOCAL end radar 4947311 - protocol attributes */
169
170void
171objc_start_class_interface (tree ARG_UNUSED (name),
172			    tree ARG_UNUSED (super),
173/* APPLE LOCAL begin radar 4548636 */
174			    tree ARG_UNUSED (protos),
175			    tree ARG_UNUSED (attributes))
176/* APPLE LOCAL end radar 4548636 */
177{
178}
179
180void
181objc_start_category_interface (tree ARG_UNUSED (name),
182			       tree ARG_UNUSED (categ),
183			       tree ARG_UNUSED (protos))
184{
185}
186
187void
188objc_continue_interface (void)
189{
190}
191
192void
193objc_finish_interface (void)
194{
195}
196
197void
198objc_add_instance_variable (tree ARG_UNUSED (decl))
199{
200}
201
202void
203objc_set_visibility (int ARG_UNUSED (vis))
204{
205}
206
207void
208objc_set_method_type (enum tree_code ARG_UNUSED (code))
209{
210}
211
212void
213objc_start_class_implementation (tree ARG_UNUSED (name),
214				 tree ARG_UNUSED (super))
215{
216}
217
218void
219objc_start_category_implementation (tree ARG_UNUSED (name),
220				    tree ARG_UNUSED (categ))
221{
222}
223
224void
225objc_continue_implementation (void)
226{
227}
228
229void
230objc_clear_super_receiver (void)
231{
232}
233
234void
235objc_finish_implementation (void)
236{
237}
238
239void
240/* APPLE LOCAL begin radar 3803157 - objc attribute */
241objc_add_method_declaration (tree ARG_UNUSED (signature),
242			     tree ARG_UNUSED (attribute))
243/* APPLE LOCAL end radar 3803157 - objc attribute */
244{
245}
246
247void
248/* APPLE LOCAL begin radar 3803157 - objc attribute */
249objc_start_method_definition (tree ARG_UNUSED (signature),
250			      tree ARG_UNUSED (attribute))
251/* APPLE LOCAL end radar 3803157 - objc attribute */
252{
253}
254
255void
256objc_finish_method_definition (tree ARG_UNUSED (fndecl))
257{
258}
259
260tree
261objc_build_keyword_decl (tree ARG_UNUSED (selector),
262			 tree ARG_UNUSED (typename),
263			 /* APPLE LOCAL begin radar 4157812 */
264			 tree ARG_UNUSED (identifier),
265			 tree ARG_UNUSED (attribute))
266			 /* APPLE LOCAL end radar 4157812 */
267{
268  return 0;
269}
270
271tree
272objc_build_method_signature (tree ARG_UNUSED (rettype),
273			     tree ARG_UNUSED (selectors),
274			     tree ARG_UNUSED (optparms),
275			     bool ARG_UNUSED (ellipsis))
276{
277  return 0;
278}
279
280tree
281objc_build_encode_expr (tree ARG_UNUSED (expr))
282{
283  return 0;
284}
285
286tree
287objc_build_protocol_expr (tree ARG_UNUSED (expr))
288{
289  return 0;
290}
291
292tree
293objc_build_selector_expr (tree ARG_UNUSED (expr))
294{
295  return 0;
296}
297
298tree
299objc_build_message_expr (tree ARG_UNUSED (expr))
300{
301  return 0;
302}
303
304tree
305objc_build_string_object (tree ARG_UNUSED (str))
306{
307  return 0;
308}
309
310tree
311objc_get_class_reference (tree ARG_UNUSED (name))
312{
313  return 0;
314}
315
316/* APPLE LOCAL begin radar 4291785 */
317tree
318objc_get_interface_ivars (tree ARG_UNUSED (fieldlist))
319{
320  return 0;
321}
322void
323objc_detect_field_duplicates (tree ARG_UNUSED (fieldlist))
324{
325}
326/* APPLE LOCAL end radar 4291785 */
327
328tree
329objc_get_protocol_qualified_type (tree ARG_UNUSED (name),
330				  tree ARG_UNUSED (protos))
331{
332  return 0;
333}
334
335int
336objc_static_init_needed_p (void)
337{
338  return 0;
339}
340
341tree
342objc_generate_static_init_call (tree ARG_UNUSED (ctors))
343{
344  return 0;
345}
346
347int
348objc_is_public (tree ARG_UNUSED (expr), tree ARG_UNUSED (identifier))
349{
350  return 1;
351}
352
353/* APPLE LOCAL begin C* language */
354void
355objc_set_method_opt (int ARG_UNUSED (opt))
356{
357}
358
359tree
360objc_build_component_ref (tree ARG_UNUSED (datum), tree ARG_UNUSED (component))
361{
362  return 0;
363}
364
365tree
366objc_build_foreach_components (tree ARG_UNUSED (receiver),
367			       tree *ARG_UNUSED (enumState_decl),
368			       tree *ARG_UNUSED (items_decl),
369			       tree *ARG_UNUSED (limit_decl),
370			       tree *ARG_UNUSED (startMutations_decl),
371			       tree *ARG_UNUSED (counter_decl),
372			       tree *ARG_UNUSED (countByEnumeratingWithState))
373{
374  return 0;
375}
376/* APPLE LOCAL end C* language */
377
378/* APPLE LOCAL begin C* property (Radar 4436866) */
379void
380objc_set_property_attr (int ARG_UNUSED (code), tree ARG_UNUSED (identifier))
381{
382}
383void
384objc_add_property_variable (tree ARG_UNUSED (prop))
385{
386}
387/* APPLE LOCAL radar 5285911 */
388/* Stub for objc_build_getter_call is removed. */
389tree
390objc_build_setter_call (tree ARG_UNUSED (lhs), tree ARG_UNUSED (rhs))
391{
392  return 0;
393}
394/* APPLE LOCAL end C* property (Radar 4436866) */
395
396tree
397objc_get_class_ivars (tree ARG_UNUSED (name))
398{
399  return 0;
400}
401
402tree
403objc_build_throw_stmt (tree ARG_UNUSED (expr))
404{
405  return 0;
406}
407
408tree
409objc_build_synchronized (location_t ARG_UNUSED (start_locus),
410			 tree ARG_UNUSED (mutex), tree ARG_UNUSED (body))
411{
412  return 0;
413}
414
415void
416objc_begin_try_stmt (location_t ARG_UNUSED (try_locus), tree ARG_UNUSED (body))
417{
418}
419
420void
421objc_begin_catch_clause (tree ARG_UNUSED (decl))
422{
423}
424
425void
426objc_finish_catch_clause (void)
427{
428}
429
430void
431objc_build_finally_clause (location_t ARG_UNUSED (finally_locus),
432			   tree ARG_UNUSED (body))
433{
434}
435
436tree
437objc_finish_try_stmt (void)
438{
439  return 0;
440}
441
442tree
443objc_generate_write_barrier (tree ARG_UNUSED (lhs),
444			     enum tree_code ARG_UNUSED (modifycode),
445			     tree ARG_UNUSED (rhs))
446{
447  return 0;
448}
449/* APPLE LOCAL begin radar 5276085 */
450void objc_weak_reference_expr (tree* ARG_UNUSED (expr))
451{
452}
453
454tree
455objc_build_weak_reference_tree (tree expr)
456{
457  return expr;
458}
459/* APPLE LOCAL end radar 5276085 */
460
461/* APPLE LOCAL begin C* warnings to easy porting to new abi */
462void
463diagnose_selector_cast (tree ARG_UNUSED (cast_type), tree ARG_UNUSED (sel_exp))
464{
465}
466/* APPLE LOCAL end C* warnings to easy porting to new abi */
467
468/* APPLE LOCAL begin radar 4441049 */
469tree
470objc_v2_component_ref_field_offset (tree ARG_UNUSED (exp))
471{
472  return 0;
473}
474
475tree
476objc_v2_bitfield_ivar_bitpos (tree ARG_UNUSED (exp))
477{
478  return 0;
479}
480/* APPLE LOCAL end radar 4441049 */
481/* APPLE LOCAL begin radar 4507230 */
482bool
483objc_type_valid_for_messaging (tree ARG_UNUSED (exp))
484{
485  return false;
486}
487/* APPLE LOCAL end radar 4507230 */
488/* APPLE LOCAL begin radar 3803157 - objc attribute */
489bool
490objc_method_decl (enum tree_code ARG_UNUSED (opcode))
491{
492  return false;
493}
494/* APPLE LOCAL end radar 3803157 - objc attribute */
495
496/* APPLE LOCAL begin radar 4708210 (for_objc_collection in 4.2) */
497void
498objc_finish_foreach_loop (location_t ARG_UNUSED (location), tree ARG_UNUSED (cond),
499	  tree ARG_UNUSED (for_body), tree ARG_UNUSED (blab),
500	  tree ARG_UNUSED (clab))
501{
502  return;
503}
504/* APPLE LOCAL end radar 4708210 (for_objc_collection in 4.2) */
505/* APPLE LOCAL begin radar 5847976 */
506int
507objc_is_gcable_type (tree ARG_UNUSED (type))
508{
509  return 0;
510}
511/* APPLE LOCAL end radar 5847976 */
512/* APPLE LOCAL begin radar 4592503 */
513void
514objc_checkon_weak_attribute (tree ARG_UNUSED (decl))
515{
516  return;
517}
518/* APPLE LOCAL end radar 4592503 */
519/* APPLE LOCAL begin radar 4712269 */
520tree
521objc_build_incr_decr_setter_call (enum tree_code ARG_UNUSED (code),
522				   tree ARG_UNUSED (lhs),
523				   tree ARG_UNUSED (inc))
524{
525  return NULL_TREE;
526}
527/* APPLE LOCAL end radar 4712269 */
528/* APPLE LOCAL begin objc new property */
529void objc_declare_property_impl (int ARG_UNUSED (code),
530				 tree ARG_UNUSED (tree_list))
531{
532}
533/* APPLE LOCAL begin radar 5285911 */
534tree
535objc_build_property_reference_expr (tree ARG_UNUSED (datum),
536				    tree ARG_UNUSED (component))
537{
538  return 0;
539}
540bool
541objc_property_reference_expr (tree ARG_UNUSED (exp))
542{
543  return false;
544}
545/* APPLE LOCAL end radar 5285911 */
546/* APPLE LOCAL end objc new property */
547/* APPLE LOCAL begin radar 4985544 */
548bool
549objc_check_format_nsstring (tree ARG_UNUSED (argument),
550			     unsigned HOST_WIDE_INT ARG_UNUSED (format_num),
551			     bool * ARG_UNUSED(no_add_attrs))
552{
553  return false;
554}
555/* APPLE LOCAL end radar 4985544 */
556/* APPLE LOCAL begin radar 5202926 */
557bool
558objc_anonymous_local_objc_name (const char * ARG_UNUSED (name))
559{
560  return false;
561}
562/* APPLE LOCAL begin radar 5195402 */
563bool
564objc_check_nsstring_pointer_type (tree ARG_UNUSED (type))
565{
566  return false;
567}
568/* APPLE LOCAL end radar 5195402 */
569/* APPLE LOCAL end radar 5202926 */
570
571/* APPLE LOCAL begin radar 5782740 - blocks */
572bool block_requires_copying (tree exp)
573{
574  /* APPLE LOCAL begin radar 6175959 */
575  tree type = TREE_TYPE (exp);
576  return TREE_CODE (type) == BLOCK_POINTER_TYPE
577   || (POINTER_TYPE_P (type)
578	&& lookup_attribute ("NSObject", TYPE_ATTRIBUTES (type)));
579  /* APPLE LOCAL end radar 6175959 */
580}
581/* APPLE LOCAL end radar 5782740 - blocks */
582
583/* APPLE LOCAL begin radar 5802025 */
584tree objc_build_property_getter_func_call (tree object)
585{
586  return object;
587}
588/* APPLE LOCAL end radar 5802025 */
589